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


Debian Python Policy
Chapter 3 - Python Programs


3.1 Programs using the default python

Programs that can run with any version of Python must begin with #!/usr/bin/python or #!/usr/bin/env python (the former is preferred). They must also specify a dependency on python, with a versioned dependency if necessary.

If the program needs the python module foo, it must depend on python-foo.


3.1.1 Programs Shipping Private Modules

A program using /usr/bin/python as interpreter can come up with private Python modules. These modules should be installed in /usr/share/module, or /usr/lib/module if the modules are architecture-dependent (e.g. extensions).

/usr/lib/site-python is deprecated and should no longer be used for this purpose.

The rules explained in Modules Bytecompilation, Section 2.6 apply to those private modules: the bytecompiled modules must not be shipped with the package, they should be generated in the package's postinst, using the current default Python version, and removed in the prerm. Modules should be bytecompiled using the current default Python version.

Programs that have private compiled extensions must either handle multiple version support themselves, or declare a tight dependency on the current Python version (e.g. Depends: python (>= 2.4), python (<= 2.5). No tools currently exist to alleviate this situation.


3.2 Programs Using a Particular Python Version

A program which requires a specific version of Python must begin with #!/usr/bin/pythonX.Y (or #!/usr/bin/env pythonX.Y). It must also specify a dependency on pythonX.Y and on any pythonX.Y-foo package providing necessary modules. It should not depend on any python-foo package, unless it requires a specific version of the package (since virtual packages cannot be versioned). If this is the case, it should depend on both the virtual package and the main package (e.g. Depends: python2.4-foo, python-foo (>= 1.0)).

The notes on installation directories and bytecompilation for programs that support any version of Python also apply to programs supporting only a single Python version. Modules to be bytecompiled should use the same Python version as the package itself.


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


Debian Python Policy

version 0.4.1.0

Neil Schemenauer nas@debian.org
Matthias Klose doko@debian.org
Gregor Hoffleit flight@debian.org
Josselin Mouette joss@debian.org
Joe Wreschnig piman@debian.org