Line 9: | Line 9: | ||
The existing Python packaging guidelines are here: [[Packaging/Python]] | The existing Python packaging guidelines are here: [[Packaging/Python]] | ||
== Runtimes == | == Multiples Python Runtimes == | ||
There will be multiple python runtimes, one for each supported major/minor release combination. | There will be multiple python runtimes, one for each supported major/minor release combination. | ||
Line 24: | Line 24: | ||
Similarly, python modules using these runtimes should have a corresponding "Requires" line. | Similarly, python modules using these runtimes should have a corresponding "Requires" line. | ||
== | === Layout === | ||
== | |||
Proposed rule: All files with an extension of .py/.pyo/.pyc '''MUST''' be either | Proposed rule: All files with an extension of .py/.pyo/.pyc '''MUST''' be either | ||
* within a runtime package, and below <code>/usr/lib/python$MAJOR-$MINOR</code> for that runtime, or | * within a runtime package, and below <code>/usr/lib/python$MAJOR-$MINOR</code> for that runtime, or | ||
Line 38: | Line 32: | ||
For example, python code for the 3.1 runtime needs to be below <code>/usr/lib/python3.1/site-packages</code> | For example, python code for the 3.1 runtime needs to be below <code>/usr/lib/python3.1/site-packages</code> | ||
== .pyo/.pyc files == | === .pyo/.pyc files === | ||
Compiled .pyo/.pyc files embed a magic number, indicating which python version they are for; python libraries have a corresponding magic number. | Compiled .pyo/.pyc files embed a magic number, indicating which python version they are for; python libraries have a corresponding magic number. | ||
Line 50: | Line 44: | ||
https://www.zarb.org/pipermail/rpmlint-discuss/2009-October/000775.html and here: | https://www.zarb.org/pipermail/rpmlint-discuss/2009-October/000775.html and here: | ||
http://dmalcolm.fedorapeople.org/rpmlint/add-tests-for-python-bytecode-files.patch | http://dmalcolm.fedorapeople.org/rpmlint/add-tests-for-python-bytecode-files.patch | ||
== Python modules for non-standard runtimes == | |||
(to be written) | |||
=== Naming === | |||
Current python package naming guidelines are here: | |||
[[Packaging/NamingGuidelines#Addon_Packages_.28python_modules.29]] |
Revision as of 21:31, 29 October 2009
Packaging Python modules for Python 3
I hope to add a parallel-installable Python 3 stack to Fedora 13.
See the feature page: https://fedoraproject.org/wiki/Features/Python3F13 and also this thread: https://www.redhat.com/archives/fedora-devel-list/2009-October/msg00054.html
This requires us to come up with a sane way to package Python 3 modules, and this requires us to generalize our python packaging rules to support more than one python runtime.
The existing Python packaging guidelines are here: Packaging/Python
Multiples Python Runtimes
There will be multiple python runtimes, one for each supported major/minor release combination.
Each runtime corresponds to a binary of the form /usr/bin/python$MAJOR.$MINOR
One of these python runtimes is the "system runtime". It can be identified by the destination of the symlink /usr/bin/python
The output of "rpm -q --provides" of each runtime rpm MUST contain a line of the form:
Provides: python(abi) = $MAJOR-$MINOR
For example, a python-3.1 runtime rpm should have this output:
Provides: python(abi) = 3.1
Similarly, python modules using these runtimes should have a corresponding "Requires" line.
Layout
Proposed rule: All files with an extension of .py/.pyo/.pyc MUST be either
- within a runtime package, and below
/usr/lib/python$MAJOR-$MINOR
for that runtime, or - for a specific runtime package, and below
/usr/lib/python$MAJOR-$MINOR/site-packages
for that runtime, or - for the system python runtime.
For example, python code for the 3.1 runtime needs to be below /usr/lib/python3.1/site-packages
.pyo/.pyc files
Compiled .pyo/.pyc files embed a magic number, indicating which python version they are for; python libraries have a corresponding magic number.
Proposed rule: All .pyo/.pyc files below /usr/lib/python$MAJOR.$MINOR MUST have a magic number corresponding to that for /usr/bin/python$MAJOR.$MINOR
Thus e.g. /usr/lib/python2.6/site-packages/libxml2.pyc
must have the same magic number as that of /usr/bin/python2.6
Similarly, /usr/lib/python3.1/site-packages/libxml2.pyc
must have the same magic number as that of /usr/bin/python3.1
TODO: write an rpmlint test for this. See initial work here: https://www.zarb.org/pipermail/rpmlint-discuss/2009-October/000775.html and here: http://dmalcolm.fedorapeople.org/rpmlint/add-tests-for-python-bytecode-files.patch
Python modules for non-standard runtimes
(to be written)
Naming
Current python package naming guidelines are here: Packaging/NamingGuidelines#Addon_Packages_.28python_modules.29