[Distutils] Creating rpm's for multiple python versions?

Phil Schwartz phil_schwartz at users.sourceforge.net
Tue Jun 17 04:45:15 CEST 2008

From: phil_schwartz at users.sourceforge.net

Thanks for the reference Ignacio, however, I'm not sure how this applies to packaging the rpm in 
my current build environment.


If you are installing anything into the global site_packages directory, use the following trick.
First, define python_sitelib at the top of your specfile:

%{!?python_sitelib: %define python_sitelib %(%{__python} -c \
"from distutils.sysconfig import get_python_lib; print get_python_lib()")}

[End Quote]

since I don't have a spec file (distutils may create one as necessary and delete it).  

Running the following command returns the expected result:

$ python2.3 -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

But not sure how to include this in distutils (setup.py, setup.cfg, MANIFEST.in, etc).

Certainly, someone else be packaging their python apps for multiple python versions.  

Thanks for any addition leads,


Ignacio Vazquez-Abrams wrote:

You may want to consider reading Fedora's Python packaging

[1] http://fedoraproject.org/wiki/Packaging/Python

On Fri, 2008-06-13 at 14:36 -0700, Phil Schwartz wrote:
> > I have a Fedora Core 7 development server that has python2.3,
> > python2.4 and python2.5 installed.  I'd like to build rpm's of my
> > application for each
> > of these versions of python.

> > How can I force the rpm's to include the proper site-packages path
> > (for python2.3 that would be "/usr/lib/python2.3/site-packages/")?

-- Ignacio Vazquez-Abrams <ivazqueznet at gmail.com> 

More information about the Distutils-SIG mailing list