[Distutils] Packages with C extensions

M.-A. Lemburg mal@lemburg.com
Fri, 21 May 1999 15:50:19 +0200


[Problem with dynamic extensions in packages being platform dependent]

I haven't followed the thread too closely, but was alarmed by
the recent proposals of splitting .so files out of the "normal"
package distribution under a separate dir tree. This is really
not such a good idea because it would cause the package information
stored in the extension module to be lost (you can't have two
top-level packages with the same name on the path: only the first one
on the path will be used).

Here is the scheme I would use: create a subpackage for the
extension and have it take care of importing the correct
shared lib for the platform Python is currently running on.
The libs themselves could be placed in plat-<platform> subdirs
of that subpackage and the __init__.py would then load the
shared lib using either a sys.path+__import__() hack or
thread safe via imp.load_dynamic().

An even simpler solution is installing the whole package under
.../python1.5/plat-<platform> separately for each supported
platform rather than putting it under site-packages. [Disk space
is no argument nowadays and its likely that different platforms
need different Setup files anyway.]

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   224 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/