Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ef2ba7

Browse files
committed
Minor tweaks to catch up with the current code in a few spots.
Wrote the "Distutils Configuration Files" section.
1 parent d097d48 commit 7ef2ba7

1 file changed

Lines changed: 147 additions & 16 deletions

File tree

Doc/inst/inst.tex

Lines changed: 147 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@ \subsection{How building works}
271271
temp.<plat>/
272272
\end{verbatim}
273273
where \code{<plat>} expands to a brief description of the current
274-
OS/hardware platform. The first form, with just a \file{lib} directory,
275-
is used for ``pure module distributions''---that is, module
276-
distributions that include only pure Python modules. If a module
277-
distribution contains any extensions (modules written in C/C++, or Java
278-
for JPython), then the second form, with two \code{<plat>} directories,
279-
is used. In that case, the \file{temp.\filevar{plat}} directory holds
280-
temporary files generated by the compile/link process that don't
281-
actually get installed. In either case, the \file{lib} (or
274+
OS/hardware platform and Python version. The first form, with just a
275+
\file{lib} directory, is used for ``pure module distributions''---that
276+
is, module distributions that include only pure Python modules. If a
277+
module distribution contains any extensions (modules written in C/C++),
278+
then the second form, with two \code{<plat>} directories, is used. In
279+
that case, the \file{temp.\filevar{plat}} directory holds temporary
280+
files generated by the compile/link process that don't actually get
281+
installed. In either case, the \file{lib} (or
282282
\file{lib.\filevar{plat}}) directory contains all Python modules (pure
283283
Python and extensions) that will be installed.
284284

@@ -300,7 +300,7 @@ \subsection{How installation works}
300300
\code{setup.py install}---then the \command{install} command installs to
301301
the standard location for third-party Python modules. This location
302302
varies by platform and by how you built/installed Python itself. On
303-
Unix and Mac OS, it also depends on whether the module distribution
303+
Unix and Mac~OS, it also depends on whether the module distribution
304304
being installed is pure Python or contains extensions (``non-pure''):
305305
\begin{tableiv}{l|l|l|c}{textrm}%
306306
{Platform}{Standard installation location}{Default value}{Notes}
@@ -317,12 +317,12 @@ \subsection{How installation works}
317317
{\filenq{C:\textbackslash{}Python}}
318318
{(2)}
319319
\lineiv{Mac~OS (pure)}
320-
{\filenq{\filevar{prefix}:Lib}}
321-
{\filenq{Python:Lib} \XXX{???}}
320+
{\filenq{\filevar{prefix}:Lib:site-packages}}
321+
{\filenq{Python:Lib:site-packages}}
322322
{}
323323
\lineiv{Mac~OS (non-pure)}
324-
{\filevar{prefix}:Mac:PlugIns}
325-
{\filenq{Python:Mac:PlugIns}\XXX{???}}
324+
{\filenq{\filevar{prefix}:Lib:site-packages}}
325+
{\filenq{Python:Lib:site-packages}}
326326
{}
327327
\end{tableiv}
328328

@@ -361,9 +361,11 @@ \subsection{How installation works}
361361
'/usr'
362362
\end{verbatim}
363363

364-
If you don't want to install to the standard location, or if you don't
365-
have permission to write there, then you need to read about alternate
366-
installations in the next section.
364+
If you don't want to install modules to the standard location, or if you
365+
don't have permission to write there, then you need to read about
366+
alternate installations in section~\ref{alt-install}. If you want to
367+
customize your installation directories more heavily, see
368+
section~\ref{custom-install} on custom installations.
367369

368370

369371
% This rather nasty macro is used to generate the tables that describe
@@ -711,6 +713,135 @@ \section{Custom Installation}
711713
\section{Distutils Configuration Files}
712714
\label{config-files}
713715

716+
As mentioned above, you can use Distutils configuration files to record
717+
personal or site preferences for any Distutils options. That is, any
718+
option to any command can be stored in one of two or three (depending on
719+
your platform) configuration files, which will be consulted before the
720+
command-line is parsed. This means that configuration files will
721+
override default values, and the command-line will in turn override
722+
configuration files. Furthermore, if multiple configuration files
723+
apply, values from ``earlier'' files are overridden by ``later'' files.
724+
725+
726+
\subsection{Location and names of config files}
727+
\label{sec:config-filenames}
728+
729+
The names and locations of the configuration files vary slightly across
730+
platforms. On Unix, the three configuration files (in the order they
731+
are processed) are:
732+
\begin{tableiii}{l|l|c}{textrm}
733+
{Type of file}{Location and filename}{Notes}
734+
\lineiii{system}{\filenq{\filevar{prefix}/lib/python\filevar{ver}/distutils/pydistutils.cfg}}{(1)}
735+
\lineiii{personal}{\filenq{\$HOME/.pydistutils.cfg}}{(2)}
736+
\lineiii{local}{\filenq{setup.cfg}}{(3)}
737+
\end{tableiii}
738+
739+
On Windows, the configuration files are:
740+
\begin{tableiii}{l|l|c}{textrm}
741+
{Type of file}{Location and filename}{Notes}
742+
\lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}pydistutils.cfg}}{(4)}
743+
\lineiii{personal}{\filenq{\%HOME\textbackslash{}pydistutils.cfg}}{(5)}
744+
\lineiii{local}{\filenq{setup.cfg}}{(3)}
745+
\end{tableiii}
746+
747+
And on Mac~OS, they are:
748+
\begin{tableiii}{l|l|c}{textrm}
749+
{Type of file}{Location and filename}{Notes}
750+
\lineiii{system}{\filenq{\filevar{prefix}:Lib:distutils:pydistutils.cfg}}{(6)}
751+
\lineiii{personal}{N/A}{}
752+
\lineiii{local}{\filenq{setup.cfg}}{(3)}
753+
\end{tableiii}
754+
755+
\noindent Notes:
756+
\begin{description}
757+
\item[(1)] Strictly speaking, the system-wide configuration file lives
758+
in the directory where the Distutils are installed; under Python 1.6
759+
and later on Unix, this is as shown. For Python 1.5.2, the Distutils
760+
will normally be installed to
761+
\file{\filevar{prefix}/lib/site-packages/python1.5/distutils},
762+
so the system configuration file should be put there under Python
763+
1.5.2.
764+
\item[(2)] On Unix, if the \envvar{HOME} environment variable is not
765+
defined, the user's home directory will be determined with the
766+
\function{getpwuid()} function from the standard \module{pwd} module.
767+
\item[(3)] I.e., in the current directory (usually the location of the
768+
setup script).
769+
\item[(4)] (See also note (1).) Under Python 1.6 and later, Python's
770+
default ``installation prefix'' is \file{C:\textbackslash{}Python}, so
771+
the system configuration file is normally
772+
\file{C:\textbackslash{}Python\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}pydistutils.cfg}.
773+
Under Python 1.5.2, the default prefix was
774+
\file{C:\textbackslash{}Program~Files\textbackslash{}Python}, and the
775+
Distutils were not part of the standard library---so the system
776+
configuration file would be
777+
\file{C:\textbackslash{}Program~Files\textbackslash{}Python\textbackslash{}distutils\textbackslash{}pydistutils.cfg}
778+
in a standard Python 1.5.2 installation under Windows.
779+
\item[(5)] On Windows, if the \envvar{HOME} environment variable is not
780+
defined, no personal configuration file will be found or used. (In
781+
other words, the Distutils make no attempt to guess your home
782+
directory on Windows.)
783+
\item[(6)] (See also notes (1) and (4).) The default installation
784+
prefix is just \file{Python:}, so under Python 1.6 and later this is
785+
normally\file{Python:Lib:distutils:pydistutils.cfg}. (The Distutils
786+
don't work very well with Python 1.5.2 under Mac~OS. \XXX{true?})
787+
\end{description}
788+
789+
790+
\subsection{Syntax of config files}
791+
\label{sec:config-syntax}
792+
793+
The Distutils configuration files all have the same syntax. The config
794+
files are grouped into sections; there is one section for each Distutils
795+
command, plus a \code{global} section for global options that affect
796+
every command. Each section consists of one option per line, specified
797+
like \code{option=value}.
798+
799+
For example, the following is a complete config file that just forces
800+
all commands to run quietly by default:
801+
\begin{verbatim}
802+
[global]
803+
verbose=0
804+
\end{verbatim}
805+
806+
If this is installed as the system config file, it will affect all
807+
processing of any Python module distribution by any user on the current
808+
system. If it is installed as your personal config file (on systems
809+
that support them), it will affect only module distributions processed
810+
by you. And if it is used as the \file{setup.cfg} for a particular
811+
module distribution, it affects only that distribution.
812+
813+
You could override the default ``build base'' directory and make the
814+
\command{build*} commands always forcibly rebuild all files with the
815+
following:
816+
\begin{verbatim}
817+
[build]
818+
build-base=blib
819+
force=1
820+
\end{verbatim}
821+
which corresponds to the command-line arguments
822+
\begin{verbatim}
823+
python setup.py build --build-base=blib --force
824+
\end{verbatim}
825+
except that including the \command{build} command on the command-line
826+
means that command will be run. Including a particular command in
827+
config files has no such implication; it only means that if the command
828+
is run, the options in the config file will apply. (Or if other
829+
commands that derive values from it are run, they will use the values in
830+
the config file.)
831+
832+
You can find out the complete list of options for any command using the
833+
\longprogramopt{help} option, e.g.:
834+
\begin{verbatim}
835+
python setup.py build --help
836+
\end{verbatim}
837+
and you can find out the complete list of global options by using
838+
\longprogramopt{help} without a command:
839+
\begin{verbatim}
840+
python setup.py --help
841+
\end{verbatim}
842+
See also the ``Reference'' section of the ``Distributing Python
843+
Modules'' manual.
844+
714845

715846
\section{Pre-Distutils Conventions}
716847
\label{pre-distutils}

0 commit comments

Comments
 (0)