Debian Python Policy - Packaging Tools

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ A ] [ B ] [ C ] [ next ]

# Debian Python Policy
Appendix B - Packaging Tools

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 (deprecated)

python-support is deprecated. It is a system intended to provide 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 (deprecated)

python-central is deprecated. It 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.

## B.5 dh_python2 and dh_python3

dh_python2 and dh_python3 are `debhelper` extensions provided as part of Python and Python3 to make it easier to package Python modules and extensions. They calculate Python dependencies, add maintainer scripts to byte compile files, etc. Their use is not mandatory, but they are recommended by the Python maintainers. See man dh_python2 or man dh_python3 for details.

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ A ] [ B ] [ C ] [ next ]

Debian Python Policy