[Distutils] Possible to import from a zipfile retrieved from within an .egg using pkg_resource's ResourceManager API?
P.J. Eby
pje at telecommunity.com
Wed Jul 22 23:11:48 CEST 2009
At 03:05 PM 7/22/2009 -0500, Dave Peterson wrote:
>P.J. Eby wrote:
>>At 07:02 PM 7/21/2009 -0500, Dave Peterson wrote:
>>
>>>Or is there a better way to do this? Perhaps there is a way to
>>>force py2app/py2exe to avoid putting Mayavi within the site-packages zipfile?
>>
>>It would probably be better to extract tvtk_classes.zip to a
>>directory of the same name, so that instead of having nested
>>zipfiles, there's only one level of zipping, and you'll just be
>>able to put the zipped subdirectory on sys.path. (Note that you can
>>put a subdirectory of a zipfile on sys.path, and it'll still work.
>>It's just that the subdirectory has to be a directory inside the
>>zipfile, not another zipfile inside the zipfile.)
>
>Thanks for the hint on a better direction! This appears to be an
>easy way to solve the py2app problem, though it requires a little
>modification to Mayavi itself since it attempts to dynamically add
>its tvtk_classes.zip to the sys.path. Just comment that out.
I suspect you needn't even do that if the directory in the zipfile is
*named* tvtk_classes.zip. It'll end up just adding that zipfile
subdirectory to sys.path, and all will be well. (YMMV, of course.)
More information about the Distutils-SIG
mailing list