On Wed, Apr 20, 2005 at 11:00:14AM +0200, M.-A. Lemburg wrote:
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.
Indeed it doesn't parse the Makefile. I believe I was remembering something else about Makefiles. Sorry. This is what we have in Fedora: if os.name == "posix": if plat_specific or standard_lib: lib = "lib64" else: lib = "lib" libpython = os.path.join(prefix, lib, "python" + get_python_version()) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages") This is what stock python 2.4.1 does: libpython = os.path.join(prefix, "lib", "python" + get_python_version()) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages")
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 ?
This makes a lot of sense. Anything that can prevent the ugly patches for multilib. Misa