[Distutils] bdist_rpm and bdist on x86-64

M.-A. Lemburg mal at egenix.com
Wed Apr 20 11:00:14 CEST 2005


Mihai Ibanescu wrote:
>>>It looks like RedHat/Fedora patch their package to only put the platform
>>>specific files in /lib64 (that's how I made my patch).
>>>
>>>Perhaps this isn't a good idea to do then :-(  I wonder whether it would
>>>be possible for distribution to set these values somewhere. Couldn't
>>>python have a sys function to return its Makefile?
> 
> 
> Fedora does it this way because of .noarch.rpm packages. Pure python
> libraries should run just fine both on x86 and x86_64, and since it's /usr/lib
> on x86, x86_64 has to know about /usr/lib too (which is sort of confusing).

Not only that, I doubt that this will work well unless
you now have two site-packages dirs (one in /usr/lib for
Python only extensions and one in /usr/lib64 for combined
Python and binary extensions).

> I believe you can get away without patching anything, if you do:
> 
> from distutils import sysconfig
> print sysconfig.get_python_lib()
> 
> to which you either pass plat_specific = 0 or 1. This will properly parse the
> right Makefile (which is probably what you ended up doing).

Uhm, this is the function that Jeremy was patching - the problem
being that the "lib" part of the path is hard-coded into this
function.

It doesn't parse the Makefile, BTW, and plat_specific only
adds site-packages to the returned directory - it doesn't
have anything to do with platform specific code.

The Makefile is the only place where Python itself can
look up how it was configured. It's easy to find:
distutils.sysconfig.get_makefile_filename();
distutils.sysconfig.parse_makefile(filename) then does the
rest. Or in one go: distutils.sysconfig.get_config_vars().

The interesting parts of the Makefile are these variables:

# Detailed destination directories
BINLIBDEST=	$(LIBDIR)/python$(VERSION)
LIBDEST=	$(SCRIPTDIR)/python$(VERSION)
INCLUDEPY=	$(INCLUDEDIR)/python$(VERSION)
CONFINCLUDEPY=	$(CONFINCLUDEDIR)/python$(VERSION)
LIBP=		$(LIBDIR)/python$(VERSION)

I guess we should change the install.py to use these
values instead of building its own little world of
pathnames.

What do you think ?

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Apr 20 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the Distutils-SIG mailing list