As mentioned above, you can use Distutils configuration files to record personal or site preferences for any Distutils options. That is, any option to any command can be stored in one of two or three (depending on your platform) configuration files, which will be consulted before the command-line is parsed. This means that configuration files will override default values, and the command-line will in turn override configuration files. Furthermore, if multiple configuration files apply, values from ``earlier'' files are overridden by ``later'' files.
The names and locations of the configuration files vary slightly across platforms. On Unixand Mac OS X, the three configuration files (in the order they are processed) are:
Type of file | Location and filename | Notes |
---|---|---|
system | prefix/lib/pythonver/distutils/distutils.cfg | (1) |
personal | $HOME/.pydistutils.cfg | (2) |
local | setup.cfg | (3) |
And on Windows, the configuration files are:
Type of file | Location and filename | Notes |
---|---|---|
system | prefix\Lib\distutils\distutils.cfg | (4) |
personal | %HOME%\pydistutils.cfg | (5) |
local | setup.cfg | (3) |
Notes:
The Distutils configuration files all have the same syntax. The config
files are grouped into sections. There is one section for each Distutils
command, plus a global
section for global options that affect
every command. Each section consists of one option per line, specified
as option=value
.
For example, the following is a complete config file that just forces all commands to run quietly by default:
[global] verbose=0
If this is installed as the system config file, it will affect all processing of any Python module distribution by any user on the current system. If it is installed as your personal config file (on systems that support them), it will affect only module distributions processed by you. And if it is used as the setup.cfg for a particular module distribution, it affects only that distribution.
You could override the default ``build base'' directory and make the
build*
commands always forcibly rebuild all files with the
following:
[build] build-base=blib force=1
which corresponds to the command-line arguments
python setup.py build --build-base=blib --force
except that including the build
command on the command-line
means that command will be run. Including a particular command in
config files has no such implication; it only means that if the command
is run, the options in the config file will apply. (Or if other
commands that derive values from it are run, they will use the values in
the config file.)
You can find out the complete list of options for any command using the --help option, e.g.:
python setup.py build --help
and you can find out the complete list of global options by using --help without a command:
python setup.py --help
See also the ``Reference'' section of the ``Distributing Python Modules'' manual.
See About this document... for information on suggesting changes.