[Python-Dev] Add a -z interpreter flag to execute a zip file
Phillip J. Eby
pje at telecommunity.com
Thu Jul 12 16:58:53 CEST 2007
At 10:09 AM 7/12/2007 +0200, Martin v. Löwis wrote:
>"" should not be removed from sys.path. It is *not* meant to be
>the current directory, but the directory where the main script
Right; it should be replaced with the zipfile path instead.
I would personally rather see this option defined as simply placing a
directory at the front of sys.path, and perhaps defining a default -m
value of __main__, unless overrridden. Being able to use the option
more than once would be nice, too. On Windows, you can't set an
environment variable on the same line as a command, so this would
give you a one-liner way of setting sys.path and running an application.
I do not see a reason to make this option zipfile-specific in any
way, though; it's just as useful (and sometimes more so) to be able
to distribute an application as a directory, since that lets you use
.pyd, .so, .dll etc. without needing the egg cache system for using those.
>Why that? Why do eggs fail to process $0 correctly, whereas the
>-z option gets it correct? That just sounds like a bug in eggs
>to me, that could be fixed - or, if not, I'd expect that -z
>cannot fix it, either.
>My understanding of this note is that
>pkg_resources uses sys.argv to determine the version number
>of the egg; IIUC, -z won't help at all here because sys.argv
>will still be the name of the symlink.
That's correct; it will not help. A change in the zipped .egg format
is required, but could be done. If the option is added (again,
without being zipfile-specific!) then there is a reason for me to
make the change.
More information about the Python-Dev