Hi everybody,
I am using some eggs, which are accessing its resources via
pkg_resources.resource_stream (or pkg_resources.resource_file_name). I
quickly looked at setuptool's pkg_resources.py, and it seems to be
written in a very extensible way, such that supporting eggs in
pyinstaller should not be difficult, knowing exactly what to do.
The problem is that it uses DefaultProvider (which works only with
resources existing as files on the filesystem), whereas ZipProvider
should be used. Provider is obtained using module.__loader__ type
(PEP302). As I checkd by comparing the configurations, pyinstaller does
not set the __loader__ attribute of a loaded module, whereas non-frozen
config sets it to a zipimporter instance. Would it be difficult to
modify the egg-loader to set this attribute? It seems that at that
moment would big part of pkg_resources just work.
I am currently trying to hack it around by setting the __loader__ by
hand. Is there a direct way to find the .egg filename? module.__file__
is bogus (build/bdist.win-amd64/egg/...; it is correct when not frozen,
though), I can perhaps use m.__path__ and strip everything which comes
after the real filepath (path/foo.zip/something/else), but that is a bit
of hack.
Cheers, Vaclav
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.