From Fedora Project Wiki

m (→‎Layout: fix markup)
Line 18: Line 18:
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.


Proposal 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
'''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.
Thus e.g. <code>/usr/lib/python2.6/site-packages/libxml2.pyc</code> must have the same magic number as that of <code>/usr/bin/python2.6</code>
  /usr/lib/python2.6/site-packages/libxml2.pyc
must have the same magic number as that of
  /usr/bin/python2.6


Similarly,
Similarly, <code>/usr/lib/python3.1/site-packages/libxml2.pyc</code> must have the same magic number as that of <code> /usr/bin/python3.1</code>
  /usr/lib/python3.1/site-packages/libxml2.pyc
 
must have the same magic number as that of
'''TODO''': write an rpmlint test for this.  See initial work here:
  /usr/bin/python3.1
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

Revision as of 22:10, 23 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.

Naming

(to be written)

Layout

All .py/.pyo/.pyc files outside of a python runtime package need to be below /usr/lib/python$MAJOR-$MINOR/site-packages

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