This section describes the various tools to help package Python programs and
modules for Debian. Although none of these tools are mandatory, their use is
strongly encouraged, as the above policy has been designed with them in mind
(and vice versa). This appendix is just an overview. If you use these tools,
you should read their full documentation.
B.1 distutils
The standard Python distutils module has been modified in Debian to change the
default installation directory of public Python modules and to add a new flag
to the "install" command to override the default,
--install-layout=. To allow the use this flag, maintainers should
ensure that at least version 2.6.2-1 will be used for python2.6, version
2.5.4-1 for python2.5, and version 2.4.6-2 for python2.4. This flag is parsed
but ignored in python2.4 and python2.5. Public Python modules installed with a
modified distutils default to
/usr/local/lib/pythonX.Y/dist-packages for python2.6 and
later. This directory is seen by the system-provided python2.6. When using a
system-provided python2.4 or python2.5, the default is
/usr/lib/pythonX.Y/site-packages which is seen by the
system-provided python2.4 and python2.5 versions, but not by a system-provided
python2.6 and later versions. When using a local Python installation, the
default is /usr/local/lib/pythonX.Y/site-packages which
is only seen by the local Python installation. Using the
--install-layout=deb flag to the "install" command of
setup.py with a system-provided python2.6 or later versions,
Python modules will be installed to
/usr/lib/pythonX.Y/dist-packages which is only seen by
the system-provided python, not by a local installation. Using the
--install-layout=deb flag to setup.py with a
system-provided python2.4 or python2.5 does not affect the default installation
directory.
B.2 python-support
The python-support system provides a simple way to byte-compile pure Python
modules and manage dependencies. It integrates with debhelper,
manages byte-compilation, private modules, will properly use the
/usr/share/pyshared directory, integrates with runtime update hooks, and will
fill-in the ${python:Depends}, ${python:Versions},
and ${python:Provides} substvars. See the python-support
documentation in /usr/share/doc/python-support for details.
B.3 python-central
python-central provides another way to manage Python modules. It integrates
with debhelper, manages byte-compilation, private modules, will
properly use the /usr/share/pyshared directory, integrates with runtime update
hooks, and will fill-in the ${python:Depends},
${python:Versions}, and ${python:Provides} substvars.
See the python-central documentation in the pycentral(1) and dh_pycentral(1)
man pages.
B.4 CDBS
The CDBS python-distutils.mk class helps packaging of setup.py based Python
packages.