[Fedora-packaging] Python Packaging Hints

Toshio Kuratomi toshio at tiki-lounge.com
Sat Sep 17 15:56:55 UTC 2005


On Sat, 2005-09-17 at 15:07 +0800, Jeff Pitman wrote:
> Hi:
> 
> Just some hints for packaging Python (iow, makes my life easier at 
> http://python.org/pyvault).
> 
> 1. Use %{__python} as opposed to python in any scriptlets. Especially be 
> wary of the %pyver definitions using a call to python to grab the 
> version.

What's the justification for the %pyver wariness?

> 2. Also, I need opinions on #!/usr/bin/python  vs.  
> #!/usr/bin/pythonX.Y.  Because if a package installs 
> into /usr/lib/pythonX.Y/site-packages, then any old /usr/bin/python 
> won't work, it'd have to be the version specific /usr/bin/pythonX.Y.  
> This might be a problem specific to my stuff, so you can ignore it if 
> it is.
> http://groups.google.com/group/linux.debian.maint.python/browse_thread/thread/8d68b4c5434daa6a/703315fed09e0c18%23703315fed09e0c18?sa=X&oi=groupsr&start=0&num=3
> 
#!/usr/bin/pythonX.Y needs more package maintainer work than
#!/usr/bin/python

In Fedora Extras, we use a mock chroot build environment to build a
different package for each Fedora Core release so we use a %pyver
construct in order to find out which python version is appropriate for
the Fedora Core version being built for.  Look, for instance, at the
qa-assistant spec file for how this is done.  This allows us to leave
the spec file basically unchanged between the different FC releases even
though the python version has bumped numbers and locations.

Note that FC4 (I believe) introduced an automatic, rpm-added
"python(abi) = X.Y" for python packages.  So for FC4 and later the
versioning in the rpm Requires: is taken care of for you.  In your %
files section you'd then use:
  %files
  %{_libdir}/python?.?/site-packages/[MODULEDIR]
to get the proper files with different python versions.

If you're using a chroot in pyvault this method may work for you as
well.

-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-packaging/attachments/20050917/90349564/attachment.sig>


More information about the Fedora-packaging mailing list