GetRidOfPythonCentralAndSupport

Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2008-06-02 06:53:32
Size: 6048
Editor: a91-154-115-6
Comment:
Revision 6 as of 2008-07-16 10:16:40
Size: 17732
Editor: yttrium
Comment: fix markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
 * '''Launchpad Entry''': UbuntuSpec:get-rid-of-python-central-and-support
 * '''Created''': 2008-06-02
 * '''Contributors''': LarsWirzenius
 * '''Packages affected''': python, python-central, python-support (+ everything Python related)

== Nota Bene ==

This is undergoing a re-think and a re-write. Stay tuned for more updates
to come soon, and please don't worry if this document is self-contradictory
at the moment.
Line 3: Line 14:
The python-central and python-support packages will be removed.
They are currently needed so that Python modules and extensions can
be installed once per system, rather than once per installed Python
interpreter. This will require changing the Python interpreter to
support having byte code files and extension .so files for different
versions of the interpreter in the same directory.
Pure Python modules are currently installed in a single location, and
symlinks are created at package installation time from site-packages
to the single location. This way, a single copy of a module can server
for all installed Python versions. Howeer, creating the symlinks is
error prone, and can cause problems during upgrades.

The proposal is to have the symlinks created at package build time
so that they are included in the .deb, so that dpkg creates them at
the right time. This way the python-central and python-support packages
become build-time dependencies instead of run-time dependencies.

(FIXME: This summary is incomplete. We'll update it when things become
more stable.)
Line 13: Line 31:
will require only minor changes to their source. Users of packages will will require no or only minor changes to their source. Users of packages will
Line 15: Line 33:

== Exploring the Phase Space of Python Packaging ==

Packaging the Python implementation and software implemented in
Python is not always straightforward. This section explores some
of the challenges involved in order to provide a basis for discussing
improvements in how the packaging is done.

This section starts with the basics, for clarity. It is written so that
things are as clear as they can be, which means not assuming everyone
understands the entire history. This section should probably be moved
to a different document before the final spec.

=== Terminology ===

 * '''Python implementation''': The Python interpreter, written in C.
 Several versions of the interpreter can be installed at the same time:
 `/usr/bin/python2.4`, `/usr/bin/python2.5`, etc. The interpreters are
 packaged in packages named `python-X.Y`. The different versions are
 completely independent of each other.
 * '''Default Python interpreter''': The default Python interpreter,
 installed as `/usr/bin/python`. This is a symlink to the appropropriate
 pythonX.Y executable. The symlink is governed by the package
 `python`.
 * '''Python module''': a pure Python file (''foo.py''). When installed
 onto the system, they should (currently) be accessible via the
 /usr/lib/pythonX.Y/site-packages directory.
 * '''Python byte code file''': Python byte code installed into a file
 ('''foo.pyc''' and/or '''python.pyo'''). Byte codes with an X.Y series
 (X.Y.0, X.Y.1, etc) are compatible, but this is not true if X or Y
 changes.
 * '''Python extension''': a shared object (''foo.so''), typically built
 from C, and loaded by the Python interpreter as if it were a Python
 module. Extensions need to be compiled for each Python interpreter
 version (X.Y) separately, since the ABI is not stable.
 * '''Python package''': a collection of Python modules and extensions
 in a directory which contains a `__init__.py` file. (This is highly
 simplified.)

=== More than one Python version? ===

Debian and Ubuntu need to support more than one concurrently installed
Python version. This is necessary because software does not always work
with every version of Python, and different software included in the
distribution might need different versions of Python. For example, Zope
may require Python 2.4, and breaks with 2.5, whereas something else
might not work with 2.4, and requires 2.5.

In addition, upgrades between releases of the distributions need to work.
If the previous release had only Python 2.4, and the new one had only 2.5,
there
will probably a long phase during the upgrade when Python or some of the
software implemented in Python would not be fully
operational. This would prevent using Python for tools involved in, or used
during the upgrade, which would be a crippling restriction.

=== Default Python version? ===

The decision of what is the default Python version is made by the
distributions based on an analysis of how well the new version works,
and, more importantly, how well software implemented in Python works
with the new version. If most of the system is happy with 2.5, then
2.5 can be made the default version. Anything that still requires 2.4
will be changed to require and use it explicitly, rather than using
the default Python version.

However, it is not practical to modify every Python package separately
to switch to a new version of Python. There are too many such packages.

=== Byte code compilation in Python ===

The Python intepreter compiles a Python module into byte code when it
loads it. If it can, it will also write the byte code into a .pyc file,
or a .pyo file if running in optimised mode. It can do that if the file
does not already exist, and it has write permission to the directory.

This storing of byte code in files happens implicitly, invisibly, when
the program runs. It can also be done explicitly by calling a compilation
script provided with Python.

=== Byte code compilation with .deb packages ===

Byte codes could generated when the package is built, and included
in the .deb file. This increases the size of the package quite a bit:
byte code is not small, it is on the order of magnitude ofthe source
code. Debian and Ubuntu feel that it is better to generate the byte
code files on the installed system instead. This saves bandwidth and
disk space on mirrors.

Compilation happens in the .deb postinst script, and removal in the
postrm script.

=== Byte code non-compilation and programs run by root ===

If the package does not take care to generate and remove byte code, and
the program is run by root, the byte code will be left on the filesystem
when the package is removed. This is considered to be a (small) bug.

=== The byte code and Python version problem ===

Byte codes between Python interpreter versions (major/minor, not counting
patch level changes) are not necessarily compatible. That is, byte code
compiled for the 2.4 version of Python might not work for the 2.5 version.

The Python interpreters recognize when the byte code is not compiled
for them, and will ignore it (and compile it internally for themselves).
Having the wrong byte code file will not thus break anything, but it will
impact performance.

=== Idea: Distributing only byte code, not Python module source ===

It would be possible to distribute only the byte code, not the Python
module source code (.py). However, the byte code would have to be
distributed for each Python interpreter version, meaning there would
several binary packages of each Python module. This is still wasting
disk space on mirrors, and bloats the package list unnecessarily.
Compiling on the installed system is still a better compromise.

=== The symlink approach to byte code ===

The current approach is to install the Python module source in a
central location and create symlinks into /usr/lib/pythonX.Y/site-packages
for each supported pythonX.Y.

The postinst script installs the symlinks for each interpeter version,
and then byte compiles the modules. The postrm script removes both the
byte code and the symlinks.

This is fragile. The symlinks will be missing after a package is unpacked
and until is configured, and this can be a long time during a large upgrade,
such as from a release of Debian or Ubuntu to the next. This then means
the package is inoperable, which means no other software may use the
package while it is inoperable. This severely restricts how Python may
be used on these systems.

A way to fix this is to include the symlinks in the package. This means
that dpkg will create the symlinks during the unpack phase. It will also
automatically remove them, meaning that there is less for the package
to do manually.

=== Extensions and packages ===

A Python package may contain both pure Python modules, and compiled
extensions. Parts of a package may import each other using relative
names, and for this to work flawlessly in all situations, the files
must be in the same directory.

Such a package should be installed into the site-packages directory:

{{{
/usr/lib/pythonX.Y/site-packages/foo/
/usr/lib/pythonX.Y/site-packages/foo/__init__.py -> /wherever/foo/__init__.py
/usr/lib/pythonX.Y/site-packages/foo/__init__.pyc
/usr/lib/pythonX.Y/site-packages/foo/__init__.pyo
/usr/lib/pythonX.Y/site-packages/foo/foo.py -> /wherever/foo/foo.py
/usr/lib/pythonX.Y/site-packages/foo/foo.pyc
/usr/lib/pythonX.Y/site-packages/foo/foo.pyo
/usr/lib/pythonX.Y/site-packages/foo/bar.so
}}}

(`/wherever` is the location where the Python module source is stored.
It will probably be `/usr/share/pyshared/$packagename` in real life.)

=== System tools implemented in Python and release upgrades ===

FIXME: Discuss this with mvo.

=== Walkthrough of new package installation ===

 1. dpkg unpacks package. The software now works, since symlinks are
 included in the package. Byte code files don't yet exist, however.
 1. dpkg calls postinst, which compiles byte code files.

=== Walkthrough of package removal ===

 1. dpkg calls prerm, which removes byte code files. This needs to be
 done in prerm so that dpkg can remove the package's directories.
 1. dpkg removes all of the package's files and directories, except for
 conffiles. Package now now longer works.

=== Walkthrough of package upgrade ===

 1. dpkg calls preinst, which makes a list of the byte code files that
 currently exist.
 1. dpkg unpacks new version.
 1. dpkg calls postinst with "configure most-recently-configured-version".
 This removes old byte code files and creates new ones.

=== Walkthrough of system upgrade ===

FIXME: A system upgrade is just the package upgrade repeated a lot of times.
However, since so many packages change at the same time, interesting
interactions may happen. This needs to be explored further.

=== A new Python version is added to the distribution ===

When a new Python version is added to the distribution, all the packages
that (should) support it need to be rebuilt. Such packages can be found
by looking at the XS-Python-Versions header in the debian/control file.

=== A Python version is removed from the distribution ===

When a Python version is to be removed from the distribution, first
all dependencies on it need to be removed. This is accomplished by
rebuilding all relevant packages after removing the unwanted Python
version from the list of supported versions. If any dependencies
remain, they need to be resolved manually. After nothing depends on
the unwanted Python version, it can be removed from the distribution.
Line 48: Line 275:
 changes. This the transition can mostly be handled by the archive  changes. This transition can mostly be handled by the archive
Line 82: Line 309:
The design to solve this is to embed the version number in the name
of the byte code and extension files.
Thus, every byte code file and every extension needs to be built for
each interpreter version, and the files need to be placed in a location
specific to that interpreter version: /usr/lib/pythonX.Y/site-packages.
The Python module source (.py) needs to be kept in a central location
with symlinks from the site-packages directories to avoid duplicated
files.
Line 87: Line 318:
 * Add a /usr/lib/python2-site-packages directory. This will be created
 in the postinst of all Python interpreter packages, and removed in
 their postrm, if it's empty.
 * Change Python interpreter packages to add that directory to their
 search path.
 * Packages will place modules and extensions there if they work with any
 version of 2.x.
 * A module is named foo.py.
 * A package is named foo/ (i.e., foo/__init__.py exists).
 * An extension is named foo_x.y.so (where x.y is the version number of
 the Python interpreter it was built against, e.g. 2.3 or 2.4).
 * The Python interpreter is modified to look for foo_x.y.pyc before
 foo.pyc, and foo_x.y.pyo before foo.pyo.
 * The Python interpreter is modified to optionally produce foo_x.y.pyc
 and foo_x.y.pyo when compiling. This will require setting an option,
 the default will still be foo.pyc and foo.pyo.
 * The Python interpreter packages will be changed to have triggers that
 compiled/remove version specific byte code files.
 * Python module and extension packages will be changed to invoke the
 trigger.
 * Install pure Python modules into /usr/lib/pyshared.
 * debian/control declares which Python versions are supported, using
   XS-Python-Version.
 * At package build time, create symlinks from
   /usr/lib/pythonX.Y/site-packages to /usr/share/pyshared, for each
   version X.Y of Python that the package supports.
 * At package build time, build any extension for every supported version,
   and install it into /usr/lib/pythonX.Y/site-packages.
 * At package build time, generate a list of .py files in the package,
   store it in /usr/share/pyshared/file_lists/$packagename_$version.list.
 * Write a script python-byte-compile-package to compile all .py files in
   a package. The script gets the name of the package on the command line,
   and uses the file list in /usr/share/pyshared/file_lists.
 * The package's postinst needs to call python-byte-compile-package.
 * The package's postrm needs to call python-byte-compile-package --remove.

Random jotting:

{{{
debian/control:

    XS-Python-Versions: whatever
    Build-Depends(-Indep?):
        python (>= x.y.z),
        cdbs (>= x.y.z),
        debhelper (>= x.y.z),
        python-support (>= x.y.z),
        python-central (>= x.y.z)
    Depends: python (>= x.y.z)

debian/rules:

    dh_python
    dh_pycentral
    dh_pysupport
    python-debian-prepare-package --package=foo debian/tmp
    
.deb:

    usr/share/pyshared/foo/foo.py
    usr/share/pyshared/file_lists/foo.list
    usr/lib/python2.4/site-packages/foo.py ->
        ../../../share/pyshared/foo/foo.py
    usr/lib/python2.4/site-packages/bar.so
    usr/lib/python2.5/site-packages/foo.py ->
        ../../../share/pyshared/foo/foo.py
    usr/lib/python2.5/site-packages/bar.so

postinst configure prevver:

    python-byte-compile-package foo \
        --previous-version=$prevver \
        --version=a.b
    
postrm remove:

    python-byte-compile-package --remove foo --version=a.b
}}}
Line 121: Line 390:
 * Test upgrade from hardy (Ubuntu), and etch (Debian).  * Test upgrade from hardy/intrepid (Ubuntu), and etch/lenny (Debian).
Line 128: Line 397:
Ubuntu wants to implement this early on in the intrepid development
cycle, which means summer of 2008. Debian is nearing its freeze and
Ubuntu wants to implement this early on in the intrepid (or intrepid+1)
development
cycle. Debian is nearing its freeze and
Line 133: Line 403:
released. released. Except if Ubuntu wants it in intrepid+1, then this should
be implemented in Debian first.
Line 136: Line 407:
upstream. This is particularly true if they can't be implemented upstream. This is particularly true if they can't be implement

Nota Bene

This is undergoing a re-think and a re-write. Stay tuned for more updates to come soon, and please don't worry if this document is self-contradictory at the moment.

Summary

Pure Python modules are currently installed in a single location, and symlinks are created at package installation time from site-packages to the single location. This way, a single copy of a module can server for all installed Python versions. Howeer, creating the symlinks is error prone, and can cause problems during upgrades.

The proposal is to have the symlinks created at package build time so that they are included in the .deb, so that dpkg creates them at the right time. This way the python-central and python-support packages become build-time dependencies instead of run-time dependencies.

(FIXME: This summary is incomplete. We'll update it when things become more stable.)

Release Note

Python packaging will change somewhat. Packages using debhelper or cdbs will require no or only minor changes to their source. Users of packages will see no change.

Exploring the Phase Space of Python Packaging

Packaging the Python implementation and software implemented in Python is not always straightforward. This section explores some of the challenges involved in order to provide a basis for discussing improvements in how the packaging is done.

This section starts with the basics, for clarity. It is written so that things are as clear as they can be, which means not assuming everyone understands the entire history. This section should probably be moved to a different document before the final spec.

Terminology

  • Python implementation: The Python interpreter, written in C. Several versions of the interpreter can be installed at the same time: /usr/bin/python2.4, /usr/bin/python2.5, etc. The interpreters are packaged in packages named python-X.Y. The different versions are completely independent of each other.

  • Default Python interpreter: The default Python interpreter, installed as /usr/bin/python. This is a symlink to the appropropriate pythonX.Y executable. The symlink is governed by the package python.

  • Python module: a pure Python file (foo.py). When installed onto the system, they should (currently) be accessible via the /usr/lib/pythonX.Y/site-packages directory.

  • Python byte code file: Python byte code installed into a file (foo.pyc and/or python.pyo). Byte codes with an X.Y series (X.Y.0, X.Y.1, etc) are compatible, but this is not true if X or Y changes.

  • Python extension: a shared object (foo.so), typically built from C, and loaded by the Python interpreter as if it were a Python module. Extensions need to be compiled for each Python interpreter version (X.Y) separately, since the ABI is not stable.

  • Python package: a collection of Python modules and extensions in a directory which contains a __init__.py file. (This is highly simplified.)

More than one Python version?

Debian and Ubuntu need to support more than one concurrently installed Python version. This is necessary because software does not always work with every version of Python, and different software included in the distribution might need different versions of Python. For example, Zope may require Python 2.4, and breaks with 2.5, whereas something else might not work with 2.4, and requires 2.5.

In addition, upgrades between releases of the distributions need to work. If the previous release had only Python 2.4, and the new one had only 2.5, there will probably a long phase during the upgrade when Python or some of the software implemented in Python would not be fully operational. This would prevent using Python for tools involved in, or used during the upgrade, which would be a crippling restriction.

Default Python version?

The decision of what is the default Python version is made by the distributions based on an analysis of how well the new version works, and, more importantly, how well software implemented in Python works with the new version. If most of the system is happy with 2.5, then 2.5 can be made the default version. Anything that still requires 2.4 will be changed to require and use it explicitly, rather than using the default Python version.

However, it is not practical to modify every Python package separately to switch to a new version of Python. There are too many such packages.

Byte code compilation in Python

The Python intepreter compiles a Python module into byte code when it loads it. If it can, it will also write the byte code into a .pyc file, or a .pyo file if running in optimised mode. It can do that if the file does not already exist, and it has write permission to the directory.

This storing of byte code in files happens implicitly, invisibly, when the program runs. It can also be done explicitly by calling a compilation script provided with Python.

Byte code compilation with .deb packages

Byte codes could generated when the package is built, and included in the .deb file. This increases the size of the package quite a bit: byte code is not small, it is on the order of magnitude ofthe source code. Debian and Ubuntu feel that it is better to generate the byte code files on the installed system instead. This saves bandwidth and disk space on mirrors.

Compilation happens in the .deb postinst script, and removal in the postrm script.

Byte code non-compilation and programs run by root

If the package does not take care to generate and remove byte code, and the program is run by root, the byte code will be left on the filesystem when the package is removed. This is considered to be a (small) bug.

The byte code and Python version problem

Byte codes between Python interpreter versions (major/minor, not counting patch level changes) are not necessarily compatible. That is, byte code compiled for the 2.4 version of Python might not work for the 2.5 version.

The Python interpreters recognize when the byte code is not compiled for them, and will ignore it (and compile it internally for themselves). Having the wrong byte code file will not thus break anything, but it will impact performance.

Idea: Distributing only byte code, not Python module source

It would be possible to distribute only the byte code, not the Python module source code (.py). However, the byte code would have to be distributed for each Python interpreter version, meaning there would several binary packages of each Python module. This is still wasting disk space on mirrors, and bloats the package list unnecessarily. Compiling on the installed system is still a better compromise.

The current approach is to install the Python module source in a central location and create symlinks into /usr/lib/pythonX.Y/site-packages for each supported pythonX.Y.

The postinst script installs the symlinks for each interpeter version, and then byte compiles the modules. The postrm script removes both the byte code and the symlinks.

This is fragile. The symlinks will be missing after a package is unpacked and until is configured, and this can be a long time during a large upgrade, such as from a release of Debian or Ubuntu to the next. This then means the package is inoperable, which means no other software may use the package while it is inoperable. This severely restricts how Python may be used on these systems.

A way to fix this is to include the symlinks in the package. This means that dpkg will create the symlinks during the unpack phase. It will also automatically remove them, meaning that there is less for the package to do manually.

Extensions and packages

A Python package may contain both pure Python modules, and compiled extensions. Parts of a package may import each other using relative names, and for this to work flawlessly in all situations, the files must be in the same directory.

Such a package should be installed into the site-packages directory:

/usr/lib/pythonX.Y/site-packages/foo/
/usr/lib/pythonX.Y/site-packages/foo/__init__.py -> /wherever/foo/__init__.py
/usr/lib/pythonX.Y/site-packages/foo/__init__.pyc
/usr/lib/pythonX.Y/site-packages/foo/__init__.pyo
/usr/lib/pythonX.Y/site-packages/foo/foo.py -> /wherever/foo/foo.py
/usr/lib/pythonX.Y/site-packages/foo/foo.pyc
/usr/lib/pythonX.Y/site-packages/foo/foo.pyo
/usr/lib/pythonX.Y/site-packages/foo/bar.so

(/wherever is the location where the Python module source is stored. It will probably be /usr/share/pyshared/$packagename in real life.)

System tools implemented in Python and release upgrades

FIXME: Discuss this with mvo.

Walkthrough of new package installation

  1. dpkg unpacks package. The software now works, since symlinks are included in the package. Byte code files don't yet exist, however.
  2. dpkg calls postinst, which compiles byte code files.

Walkthrough of package removal

  1. dpkg calls prerm, which removes byte code files. This needs to be done in prerm so that dpkg can remove the package's directories.
  2. dpkg removes all of the package's files and directories, except for conffiles. Package now now longer works.

Walkthrough of package upgrade

  1. dpkg calls preinst, which makes a list of the byte code files that currently exist.
  2. dpkg unpacks new version.
  3. dpkg calls postinst with "configure most-recently-configured-version". This removes old byte code files and creates new ones.

Walkthrough of system upgrade

FIXME: A system upgrade is just the package upgrade repeated a lot of times. However, since so many packages change at the same time, interesting interactions may happen. This needs to be explored further.

A new Python version is added to the distribution

When a new Python version is added to the distribution, all the packages that (should) support it need to be rebuilt. Such packages can be found by looking at the XS-Python-Versions header in the debian/control file.

A Python version is removed from the distribution

When a Python version is to be removed from the distribution, first all dependencies on it need to be removed. This is accomplished by rebuilding all relevant packages after removing the unwanted Python version from the list of supported versions. If any dependencies remain, they need to be resolved manually. After nothing depends on the unwanted Python version, it can be removed from the distribution.

Rationale

The main Python implementation, also known as CPython, does not provide a stable ABI for its byte code files or binary extension (.so files). This means that Python modules and extensions (usually written in C) must be compiled for each version of the interpreter separately.

Originally this was done by having a binary package specific to each Python interpreter in the archive: a package providing the foo extension needed to provide the binary packages python2.3-foo and python2.4-foo to support both version 2.3 and 2.4 of the interpreter.

This approach had several drawbacks:

  • Adding a new version of the interpreter required updating all Python module and extension packages, and usually this required source changes.
  • There was a large number of unnecessary binary packages in the archive.
  • If you had more than one version of the interpreter in the archive, you needed multiple copies of the module source code (.py files), which wastes disk space.

Eventually in 2006 Debian (and then Ubuntu) changed to support a new approach. The packaging helper tools python-central and python-support were implemented. Now:

  • Each module and extension source package declares which interpreter versions it supports. Most of them declare that they support all of them.
  • Binary packages now bundle support for all interpreter versions in

    the same package. Where there previously were python2.3-foo and python2.4-foo, there is now only python-foo. This reduces the number of binary packages a lot, and simplifies transitions.

  • When a new Python interpreter version is added to the archive, most module and extension packages can just be rebuilt, without source changes. This transition can mostly be handled by the archive maintainers in an automated way.

The new approach has serious benefits, which must be retained. It does have some additional problems, however. The main one is the added complexity: all Python module and extension packages need special handling in their postinst and postrm scripts. Although most packages get this from python-central and python-support, it is still more complicated and fragile than is desired. It is also undesired to have two helper packages doing essentially the same thing, but with their own individual sets of bugs.

Use Cases

  • Anatole maintains a package of totleigh, a pure Python module that works with any Python interpreter version in the 2.x series.

  • Bertram maintains a package of dahlia, an extension to Python written in C that also supports all Python interpreter versions in the 2.x series.

Assumptions

At least in the initial drafts of this spec, we will assume Python 2.x. Python 3.x will not be entirely backwards compatible even at the syntax level, so the transition from 2.x will require a lot of careful thinking.

Design

The basic problem is that Python byte code files (.pyc and .pyo) and extensions (.so) are not compatible between major releases, although they are between minor revisions of the major releases (2.x.y and 2.x.z are compatible; 2.x and 2.y are not).

Thus, every byte code file and every extension needs to be built for each interpreter version, and the files need to be placed in a location specific to that interpreter version: /usr/lib/pythonX.Y/site-packages. The Python module source (.py) needs to be kept in a central location with symlinks from the site-packages directories to avoid duplicated files.

Implementation

  • Install pure Python modules into /usr/lib/pyshared.
  • debian/control declares which Python versions are supported, using
    • XS-Python-Version.
  • At package build time, create symlinks from
    • /usr/lib/pythonX.Y/site-packages to /usr/share/pyshared, for each version X.Y of Python that the package supports.
  • At package build time, build any extension for every supported version,
    • and install it into /usr/lib/pythonX.Y/site-packages.
  • At package build time, generate a list of .py files in the package,
    • store it in /usr/share/pyshared/file_lists/$packagename_$version.list.
  • Write a script python-byte-compile-package to compile all .py files in
    • a package. The script gets the name of the package on the command line, and uses the file list in /usr/share/pyshared/file_lists.
  • The package's postinst needs to call python-byte-compile-package.
  • The package's postrm needs to call python-byte-compile-package --remove.

Random jotting:

debian/control:

    XS-Python-Versions: whatever
    Build-Depends(-Indep?): 
        python (>= x.y.z),
        cdbs (>= x.y.z),
        debhelper (>= x.y.z), 
        python-support (>= x.y.z),
        python-central (>= x.y.z)
    Depends: python (>= x.y.z)

debian/rules:

    dh_python
    dh_pycentral
    dh_pysupport
    python-debian-prepare-package --package=foo debian/tmp
    
.deb:

    usr/share/pyshared/foo/foo.py
    usr/share/pyshared/file_lists/foo.list
    usr/lib/python2.4/site-packages/foo.py -> 
        ../../../share/pyshared/foo/foo.py
    usr/lib/python2.4/site-packages/bar.so
    usr/lib/python2.5/site-packages/foo.py -> 
        ../../../share/pyshared/foo/foo.py
    usr/lib/python2.5/site-packages/bar.so

postinst configure prevver:

    python-byte-compile-package foo \
        --previous-version=$prevver \
        --version=a.b
    
postrm remove:

    python-byte-compile-package --remove foo --version=a.b

debhelper and CDBS Changes

FIXME: This needs more thought.

Migration

FIXME: Needs thought.

Test/Demo Plan

  • Implement the spec in a private apt repository.
  • Rebuild all affected packages.
  • Test upgrade from hardy/intrepid (Ubuntu), and etch/lenny (Debian).
  • After upgrade, verify that system and packages work, by executing some automatic tests for selected packages.

Outstanding Issues

Ubuntu wants to implement this early on in the intrepid (or intrepid+1) development cycle. Debian is nearing its freeze and is unlikely to want to adopt the new Python packaging approach this late in the development cycle. Thus it may be necessary to implement this in Ubuntu first, and port it to Debian after lenny has been released. Except if Ubuntu wants it in intrepid+1, then this should be implemented in Debian first.

It is possible that these changes should be discussed with Python upstream. This is particularly true if they can't be implement by minor changes to search paths, and the module/extension loaders.


CategorySpec

GetRidOfPythonCentralAndSupport (last edited 2008-08-06 16:41:42 by localhost)