[Python-Dev] Add a -z interpreter flag to execute a zip file
Fred L. Drake, Jr.
fdrake at acm.org
Fri Jul 13 04:55:15 CEST 2007
At 03:52 PM 7/12/2007 -0700, Andy C wrote:
>So does everyone agree that there should be a new extension called
>.pyz? And that the definition of this is a .zip file with a
>__zipmain__.py module at its root? If so, I can make the change... I
>haven't looked around the codebase yet but it sounds easy enough.
I'm not a Windows user, so don't have a good feel for the state of the
extension mess on that platform these days. PYZ isn't listed on filext.com,
but I don't know if that means much.
On Thursday 12 July 2007, Phillip J. Eby wrote:
> Let's use __main__, please. Fewer names to remember, and __main__ is
> supposed to be the __name__ of the main program. It Just Makes Sense<TM>.
Indeed. Let's not do something so specific it's a pain to use.
Andy C:
>* Does anyone else want to change the -z flag to make more sense for
>directories (and possibly change __zipmain__.py to __main__.py)? In
>thinking about this again, I am not sure I can come up with a real use
>case.
Yes. A use case for using directories, or for *not* supporting them? These
cases should be as similar as possible; like Phillip suggested, we should be
thinking "sys.path entry" rather than "zip file".
Phillip Eby:
> Testing your package before you zip it, would be one. :) My
> personal main interest was in being able to add an item to sys.path
> without having to set $PYTHONPATH on Windows. That's why I'd like it
> to be possible to use -z more than once (or whatever the option ends up
> as).
What happens if multiple entries contain __main__.py entries? I don't like
this one so much. I don't know what Java does if you specify -jar more than
once; that might suggest something.
> The only competing proposal besides what
> I've suggested was the one to add an option to "runpy", and IMO
> that's dead in the water due to shebang argument limits.
Agreed.
Andy:
>* Magically looking at the first argument to see if it's a zip file
>seems problematic to me. I'd rather be explicit with the -z flag.
>Likewise, I'd rather be explicit and call it __zipmain__ rather than
>__main__.
Identifying ZIP files is straightforward; there's nothing weird about this
one.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
More information about the Python-Dev
mailing list