AllI have come across what I believe is a bug in setuputils bdist_egg command. According to this page http://peak.telecommunity.com/ DevCenter/EggFormats#zip-file-issues it is not possible for python's zip loader to load shared libraries directly from the zip files themselves therefore a special stub loader py file is generated for each C extension included in a package that works around this issue.
The problem I have found becomes apparent when pyd extension libraries are compiled using a process that lives outside of distutils itself (ie not using the Extension class). The code in bdist_egg.py only generates stub loaders for extensions that are built by distutils - any pyd files included in another manner are not processed. This is actually inconsistent with a method elsewhere in the distribution called exe_to_egg or somesuch where all resources are scanned and any .pyd files get a stub generated.
I've created a simple patch (attached) to fix the issue. It checks all the resources found in the all_outputs list and generates stubs for any pyd files found - this covers off cases where you have pyd files included that are not generated by distutils itself.
I understand that the preferred method would be to use distutils to do all extension builds but in my case this is not possible or desirable. I'm dynamically generating a set of extensions as the result of a toolchain that includes SWIG and needs to be refused across multiple languages so we use Ribosome to build the actual extension files in a portable manner instead of distutils. I then copy them into the final package as datafiles.
I hope that either my patch (or a modified version) can be incorporated or someone can suggest another workaround that would fix the issue allowing externally generated pyd files to have wrappers auto-generated by bdist_egg.
Many thanks in advance JKP
bdist_egg+stub_creation.patch
Description: Binary data
_______________________________________________ Distutils-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/distutils-sig
