[Python-Dev] zipfiles on sys.path
Finn Bock
bckfnn@worldonline.dk
Wed, 25 Jul 2001 21:27:37 GMT
Hi,
We have recently added support for .zip files on sys.path to Jython.
Now, after the fact, I wondered what prior art exists for such a feature
and the semantic that is used. We came up with a solution where:
- It is the name (as a string) of the zipfile that can be added to
sys.path.
- The zipfile is opened on the next import that checks this sys.path
entry and kept open until all references to the zipfile is gone
(including references from packages).
- A side effect of the implementation is that the identity of a string
on sys.path or __path__ might change during import. The value of the
string stay the same.
- 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__.
I hope it doesn't conflict too much with the solutions that already
exists or the solution (of any) that CPython might choose to adopt.
regards,
finn