Differences between revisions 1 and 32 (spanning 31 versions)
Revision 1 as of 2006-04-18 13:13:41
Size: 3455
Comment:
Revision 32 as of 2009-09-18 06:06:41
Size: 5373
Editor: GeoffSimmons
Comment: DebianBug
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#language en
#pragma section-numbers 2
Line 3: Line 6:
This is the FAQ of the debian-python@l.d.o mailing list. It is of particular interest to members of the [http://python-modules.alioth.debian.org/ Debian Python Modules Team]. This is the FAQ of the debian-python@l.d.o mailing list. It is of particular interest to members of the [[Teams/PythonModulesTeam| Debian Python Modules Team]]. Please also look at [[DebianPython]] for introductory info.
Line 5: Line 8:
== Supporting multiple python versions == <<TableOfContents(3)>>
Line 7: Line 10:
We always have several versions of Python in Debian. Some packages provide modules only for the default version, and other provide modules for all available versions. Some sources packages do that by providing several binary packages while other do that with a single one. == What are the projects and documentation available ? ==
Line 9: Line 12:
We should reduce that diversity and if possible provide the modules for all python version available within Debian. The following guidelines should help you. If you're interested in help packaging Python itself, there's [[http://alioth.debian.org/projects/pkg-python|pkg-python]] but if you want to help with the Python modules or packaging a new one, you should look at [[Teams/PythonModulesTeam| Debian Python Modules Team]] project. Both groups discuss its activities in the same debian-python@l.d.o mailing list.
Line 11: Line 14:
=== Using python-support === === python-modules ===
Line 13: Line 16:
A non-binary module (i.e. package with architecture: all) can use python-support to make the module available to all available Python versions. For this you need to install the module in a sub-directory of /usr/share/python-support and then you need to register that directory with update-python-modules in the postint (and unregister accordingly in prerm). Of course you need to add "python-support" as a dependency. Please note that the default Depends field generated by dh_python is wrong since the package now supports multiple versions. Until this is fixed you need to manually define the dependency (like "python (>=2.3), python (<< 2.5)", if you say that you support python 2.3 and python2.4). The Debian Python Modules Team has its own [[http://python-modules.alioth.debian.org/python-modules-policy.html|policy]], but keep in mind that they follow [[http://www.debian.org/doc/packaging-manuals/python-policy/|Debian Python Policy]] and of course [[http://www.debian.org/doc/debian-policy/|Debian Policy]] too.
Line 15: Line 18:
Example of postinst: == Multiple python versions support ==

Debian supports several versions of Python simultaneously. Some packages include modules only for the default version, while others provide modules for all available. Source packages may provide several binary packages for each version of Python or build a single one that suits all.

The general trend is to reduce that diversity and provide modules for all Python versions available within Debian using the following guidelines.

=== Build dependencies ===
Traditionally, build dependencies for Python extension modules included development packages for all versions of Python they were built for. For compiled modules you still have to specify each dependency separately. For Python-only modules the sole python-dev is sufficient if they use Python-based build system (like the very used distutils), python-support dependency in turn will automagically manage late-bytecompilation.

== Note on bytecompilation for pure Python modules ==

As python-support introduce late-bytecompilation, no .pyc/.pyo files shall be shipped in your package. You do no need to spend build time for generating them. With distutils use the "--no-compile -O0" options; if you are using the CDBS class, everything is already done for you. Beware some upstream sources that contain a setup.cfg which override your build options (see DebianBug:360848), then you will have to patch it. In all cases, python-support will remove those files if they are generated.

=== What is python-support? ===

Python-support is a tool to handle byte-compilation of python modules when there are several python versions installed on the system.

See /usr/share/doc/python-support/README.gz or [[http://svn.debian.org/viewsvn/collab-maint/deb-maint/python-support/trunk/README|SVN README]] for up-to-date information.

=== What is python-central? ===

Package that contains some helper scripts for building and installing python modules independent of the current installed Python version.

Some information about python-central can be found here:
http://python-modules.alioth.debian.org/python-central_howto.txt

=== Should I use python-support or python-central? ===

Most people prefer python-support, because it is better so use that. :)

Some statistics (the number of packages using each method), as of December 16, 2007:
Line 17: Line 50:
#!/bin/sh

set -e

#DEBHELPER#

if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then
        update-python-modules -i /usr/share/python-support/kid
fi
~/python-modules$ grep python-support packages/*/trunk/debian/control | wc -l
124
~/python-modules$ grep python-central packages/*/trunk/debian/control | wc -l
62
Line 28: Line 56:
Example of prerm:
{{{
#!/bin/sh

set -e

#DEBHELPER#

if which update-python-modules >/dev/null 2>&1; then
        update-python-modules -c -i /usr/share/python-support/kid
fi
}}}
Line 80: Line 96:

----
## This page is referenced from : /usr/share/cdbs/1/class/python-distutils.mk in package "cdbs"
CategoryPermalink

Debian Python FAQ

This is the FAQ of the debian-python@l.d.o mailing list. It is of particular interest to members of the Debian Python Modules Team. Please also look at DebianPython for introductory info.

1. What are the projects and documentation available ?

If you're interested in help packaging Python itself, there's pkg-python but if you want to help with the Python modules or packaging a new one, you should look at Debian Python Modules Team project. Both groups discuss its activities in the same debian-python@l.d.o mailing list.

1.1. python-modules

The Debian Python Modules Team has its own policy, but keep in mind that they follow Debian Python Policy and of course Debian Policy too.

2. Multiple python versions support

Debian supports several versions of Python simultaneously. Some packages include modules only for the default version, while others provide modules for all available. Source packages may provide several binary packages for each version of Python or build a single one that suits all.

The general trend is to reduce that diversity and provide modules for all Python versions available within Debian using the following guidelines.

2.1. Build dependencies

Traditionally, build dependencies for Python extension modules included development packages for all versions of Python they were built for. For compiled modules you still have to specify each dependency separately. For Python-only modules the sole python-dev is sufficient if they use Python-based build system (like the very used distutils), python-support dependency in turn will automagically manage late-bytecompilation.

3. Note on bytecompilation for pure Python modules

As python-support introduce late-bytecompilation, no .pyc/.pyo files shall be shipped in your package. You do no need to spend build time for generating them. With distutils use the "--no-compile -O0" options; if you are using the CDBS class, everything is already done for you. Beware some upstream sources that contain a setup.cfg which override your build options (see 360848), then you will have to patch it. In all cases, python-support will remove those files if they are generated.

3.1. What is python-support?

Python-support is a tool to handle byte-compilation of python modules when there are several python versions installed on the system.

See /usr/share/doc/python-support/README.gz or SVN README for up-to-date information.

3.2. What is python-central?

Package that contains some helper scripts for building and installing python modules independent of the current installed Python version.

Some information about python-central can be found here: http://python-modules.alioth.debian.org/python-central_howto.txt

3.3. Should I use python-support or python-central?

Most people prefer python-support, because it is better so use that. :)

Some statistics (the number of packages using each method), as of December 16, 2007:

~/python-modules$ grep python-support packages/*/trunk/debian/control | wc -l
124
~/python-modules$ grep python-central packages/*/trunk/debian/control | wc -l
62

4. Python eggs

4.1. What are Python eggs?

http://peak.telecommunity.com/DevCenter/PythonEggs

4.2. How should we package Python eggs?

We don't want to provide ".egg" files within the .deb. However we want to make the "egg meta-information" available so that users can use eggs if they so wish. For that you need to pass the option "--single-version-externally-managed" to the "setup.py install" call.

Packages relying on CDBS can do that this way:

# Install egg-info directories
DEB_PYTHON_INSTALL_ARGS_ALL += --single-version-externally-managed

4.3. How do we add Egg support to a package that doesnt support it yet?

Basicly, you should modify setup.py to use the setup function of "setuptools" instead of "distutils". Of course, you must then Build-Depends on "python-setuptools (>= 0.6a9)" which is the first version supporting the egg-info directories.

Check the following links for documentation about setuptools and creation of Eggs:

Example of minimal patch:

--- elementtree-1.2.6.old/setup.py      2006-04-18 12:25:33.000000000 +0000
+++ elementtree-1.2.6/setup.py  2006-04-18 12:26:30.000000000 +0000
@@ -7,6 +7,7 @@
 #

 from distutils.core import setup
+from setuptools import setup

 try:
     # add download_url syntax to distutils

Adding "egg support" is only required in some specific cases: when another software uses the python module via an egg and when this egg support is not yet integrated upstream.


CategoryPermalink