[Distutils] How to handle launcher script importability?
Vinay Sajip
vinay_sajip at yahoo.co.uk
Wed Aug 21 02:57:45 CEST 2013
Thomas Heller <theller <at> ctypes.org> writes:
> Ok, now I understand. But the zipfile could contain a loader-module
> for each extension which does something like this (this example extracts
> and loads 'bz2.pyd'):
In distlib, I've built on top of the zipfile support to allow C extensions
to be available. Ordinary zipfiles contain no metadata indicating the
extensions available, but wheels built with distil do. The wheel handling
code in distlib takes advantage of this. The Wheel.mount() API [1] takes
care of this (adding the wheel to sys.path, extracting the extensions to a
user-specific directory and using an import hook to call imp.load_dynamic
when required, so that both Python modules and extensions are available for
import). It seems to work, though when I introduced the Wheel.mount() API I
was told that it was very dangerous, and the sky would fall, or something :-)
Regards,
Vinay Sajip
[1] http://distlib.readthedocs.org/en/latest/tutorial.html#mounting-wheels
More information about the Distutils-SIG
mailing list