Re: [Python-Dev] Making directories and zip files executable
At 10:48 AM 9/11/2007 -0700, Guido van Rossum wrote:
I could use a refresher on how PJE's patch solves Andy's problem.
It does the same thing, but with __main__ instead of __zipmain__, and without needing the -z. So instead of "python -z foo.zip" you can just do "python foo.zip". This means you can use a reasonably cross-platform #! header that invokes Python via "env". If you tried to use -z with env, Andy's approach would either only work on BSDish platforms that support multiple options to a #! command, or else you'd have to ditch the "env" and hardcode the patht to Python. So not needing a command-line option improves the effective portability/usability of the executable zip file. Also, being able to run "python directory_to_be_zipped_later" also lets you test/develop your program without it needing to be zipped first.
On 9/11/07, Nick Coghlan
wrote: The local patch I have for PEP 366 is somewhat stale, and before I bring it up to date with SVN head, I'd like to close out the issue raised a while back regarding making zip files executable [1].
The original proposal was for a new command line switch, but PJE came up with a patch (attached to the roundup tracker item) that uses the existing import machinery to avoid the need for the extra command line switch (by checking if the argument is a valid sys.path entry before checking to see if it is an executable script).
I personally like the idea (and PJE's approach), and the performance impact on script startup time appears to be negligible (although I haven't performed any high precision measurements - I'm just using the Linux time utility on a short test script with and without the patch).
Are there any objections to my committing this?
Cheers, Nick.
participants (1)
-
Phillip J. Eby