On May 21, 10:24am, M.-A. Lemburg wrote:
Subject: Re: [PSA MEMBERS] packages in Python [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.]
As someone who maintains Python for several unix based architectures I am not concerned with disk space but really file duplication with the obvious risc to run out of sync.
Also, the plat-<platform> scheme is far from being able to capture the complexity of this world. SGI alone has 3 ABIs o32 n32 n64 multiplied by MIPS1, MIPS3, MIPS4 instruction sets yimes IRIX5.x, IRIX6.2, IRIX6.3, IRIX6.4, IRIX6.5 and many of these combinations are incompatible. !
Finally, why have a $prefix and a $ exec_prefix if it is not used to split plateform dependent stuff from platform independent.
And we should really take this dot distutil-sig :)