Mailinglist Archive: opensuse-packaging (250 mails)

< Previous Next >
[opensuse-packaging] python modules as noarch
  • From: Jan Matejek <jan.matejek@xxxxxxxxxx>
  • Date: Mon, 03 Aug 2009 20:47:04 +0200
  • Message-id: <h57bb8$iac$1@xxxxxxxxxxxxx>
Fellow python packagers,

here's something i've been working on during and post-hackweek, and that
is adopting some of Fedora's modifications so that we can build pure
python modules as noarch.

At the moment, this is enabled in OBS project
devel:languages:python:Factory (and the corresponding
"bleeding_edge_python" repositories in devel:languages:python) and used
successfully in python-setuptools package.
I'll be submitting to Factory shortly and i'd love to have this feature
in 11.2. But be aware, this might (and will) break things.

== Short how-to ==
is now in Python Packaging guidelines on the wiki:
http://en.opensuse.org/Packaging/Python#Noarch_modules

Please review your python modules. In many cases, it's enough to put
"BuildArch: noarch" into the spec file.
(Of course, don't do that now. Once the modified python is accepted into
Factory, i'll post another mail.)

== Technical details ==

The modified python now keeps "purelib" at /usr/lib/python2.6, and
"platlib" at /usr/lib(64)/python2.6. So this modification is only
meaningful on 64bits anyway, 32bits are not affected at all.
In addition to this, /usr/lib/python2.6{,/site-packages} is now created
and owned by python-base, regardless of platform, and added to python's
search path automagically.
Platform-dependent search path comes up first, so in case you installed
the 32bit and 64bit versions of the same C module, the 64bit version is
found and used first.

== Troubleshooting / Possible breakage ==

32bit side is completely unaffected, all the paths are the same.

Platform-dependent modules are not affected too. They still install
everything into /usr/lib64 on 64bits.

So let's discuss pure python modules on 64bits, shall we?

Packages using --record-rpm for keeping filelist should be (and are)
working fine with the new python. They will just install into /usr/lib
on all platforms. If not changed to noarch, it will make installing
32bit and 64bit versions alongside each other impossible - but on the
other hand, you don't need to do it anyway.

Packages keeping their own filelists in spec files will break -
distutils/setuptools will install into purelib directory, but
%py_sitelib macro is pointing into platlib.
Such packages need to be changed - either by using --record-rpm, or if
that is not possible, using the new macros adopted from Fedora.
%python_sitelib points to /usr/lib/python2.6/site-packages
%python_sitearch is /usr/lib64/python2.6/site-packages (same thing as
%py_sitelib, actually).

I'm not aware of any other possible problems besides the file list
issue. (apart from the obvious "there's no guarantee that byte-compiled
files will stay platform-independent")

regards
m.

--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >