Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75068

Re: Distributing python applications as a zip file

References <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
Date 2014-07-23 17:59 +1000
Subject Re: Distributing python applications as a zip file
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12224.1406102395.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jul 23, 2014 at 2:23 PM, Steven D'Aprano <steve@pearwood.info> wrote:
> On Linux, you can even hack the zip file to include a shebang line!
>
>
> steve@runes:~$ cat appl
> #!/usr/bin/env python
> # This is a Python application stored in a ZIP archive.
> steve@runes:~$ cat appl.zip >> appl
> steve@runes:~$ chmod u+x appl
> steve@runes:~$ ./appl
> NOBODY expects the Spanish Inquisition!!!

This, by the way, depends on a feature of the zip file format: you
start reading from the back, with the key indexes, and then come to
the front. It's designed to allow various self-extracting archive
formats to be easily unzipped (imagine, if you will, a SFX built for
Windows when you're on Unix - rather than try to run the program (with
all the difficulties and risks that would entail), you just unzip it),
and it works nicely here too. I suppose, then, it would be possible to
make a minimal Unix SFX prefix: "#!/usr/bin/env unzip\n" on the
beginning of a zip should do the job :)

(Yes, I'm aware that that violates most of the point of an SFX, in
that the target system doesn't need to have pkunzip installed, but
it's still neat how short it can be.)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Distributing python applications as a zip file Steven D'Aprano <steve@pearwood.info> - 2014-07-23 04:23 +0000
  Re: Distributing python applications as a zip file Gary Herron <gary.herron@islandtraining.com> - 2014-07-22 22:30 -0700
  Re: Distributing python applications as a zip file Chris Rebert <clp2@rebertia.com> - 2014-07-22 22:46 -0700
  Re: Distributing python applications as a zip file Tim Golden <mail@timgolden.me.uk> - 2014-07-23 08:20 +0100
  Re: Distributing python applications as a zip file Chris Angelico <rosuav@gmail.com> - 2014-07-23 17:59 +1000
  Re: Distributing python applications as a zip file Thomas Heller <theller@ctypes.org> - 2014-07-23 10:07 +0200
  Re: Distributing python applications as a zip file Leo Jay <python.leojay@gmail.com> - 2014-07-23 16:43 +0800
    Re: Distributing python applications as a zip file Alan <alan.isaac@gmail.com> - 2014-07-24 05:19 -0700
  Re: Distributing python applications as a zip file Burak Arslan <burak.arslan@arskom.com.tr> - 2014-07-23 15:23 +0300
    Re: Distributing python applications as a zip file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-24 00:55 +0000

csiph-web