Table of Contents
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
.
A program using /usr/bin/python
as
interpreter can come up with private Python modules. These
modules should be installed in
/usr/share/
, or
module
/usr/lib/
if the modules are
architecture-dependent (e.g. extensions).
module
/usr/lib/site-python
is deprecated and should
no longer be used for this purpose.
The rules explained in Section 2.6, “Modules Bytecompilation” 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.
A program which requires a specific version of Python must
begin with
#!/usr/bin/python
(or
X
.Y
#!/usr/bin/env python
). It
must also specify a dependency on
X
.Y
python
and on
any X
.Y
python
package providing necessary modules. It should not depend on
any X
.Y
-foopython-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.