[Python-Dev] zipfiles on sys.path
Mon, 30 Jul 2001 19:16:36 GMT
Thanks for the feedback.
>> - The __path__ vrbl in a package 'foo.bar' loaded from zipfile.zip
>> will have the value ['zipfile.zip!foo/bar'] and this same syntax can
>> also be used when adding entries to sys.path and __path__.
>__path__ is set to the package name. I'm not sure of the exact
>rationale for this (Just did the package support) but it seems to work
I think the result of the Mac implementation is that the package
hierarchy and the folder structure in the archive must match. Normally
this is the case but changes to __path__ can cause sub-modules to loaded
from somewhere else. I'm guessing such changes to to __path__ isn't
considered on Mac when importing from an archive.
>I don't know the rationale either (or at least: not anymore ;-), I just copied
>the behavior of frozen packages (as in freeze.py) from import.c.
>PyImport_ImportFrozenModule() contains this snippet:
Dynamic changes to __path__ is probably not needed for frozen packages.
It may not even be needed for imports from zipfile. My first attempt of
adding this feature did not support changes to __path__.