Some Python Packaging Questions

Ville Skyttä ville.skytta at iki.fi
Mon Aug 23 07:19:00 UTC 2004


On Mon, 2004-08-23 at 09:27, Jeff Pitman wrote:

> This previous thread is relevant:
> http://www.redhat.com/archives/fedora-devel-list/2004-May/msg00698.html
> 
> Some packages are using this as a Requires:, but not all.  Fedora.us 
> implements a slightly different scheme in the spec template.

FYI: the spec template used distutils.sysconfig.get_python_version()
which is available only in Python >= 2.3; that has been changed to the
sys.version[:3] approach in the latest version which should be published
soon (bugzilla.fedora.us 1401).  (The fedora.us python-forward-compat
package provides python-abi stuff for < FC2.)

> Lastly, in the fedora.us spec template, I still don't see how 
> differentiation on the directories produces anything useful:
> # For noarch packages:
> Requires:       %{python_sitelib}
> # For arch-dependent packages:
> Requires:       %{python_sitearch}
> 
> On my systems, this will always expand to the same versioned library 
> directory. Does this have to do with 64-bit somehow?

Yes.  sitelib should always point to the architecture independent
location (/usr/lib/... in current python packages), and sitearch to the
arch-dependent one (%{_libdir}/... in current python packages).  With
x86_64, there was a bug in the python package that resulted both of the
above being %{_libdir} which again caused borkage (in a way that those
macros expanded to wrong locations even if the sofware was installed to
the correct ones) when a noarch Python extension package was built on
x86_64.  That has been fixed in Rawhide.

Note that these variables are usually for convenience only for eg
%install and %files sections, they are not passed to builds using
distutils.  They are there to increase the probability that extension
packages just need to be rebuilt if there are changes in the way Python
itself is packaged wrt directory layout, or to build for a custom Python
setup, without having to do any specfile tweaking.

As of now, one could fairly safely use /usr/lib*/python%{pyver}/...
everywhere, but I guess one beautiful day arch-independent Python
extensions will be installed in /usr/share/python%{pyver}/...  And as
noted above, one can redefine %__python to build for a custom Python
installation in which case we can't assume much at all.





More information about the fedora-devel-list mailing list