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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'linux,': 0.07; 'nicely': 0.07; 'subject:file': 0.07; 'violates': 0.09; 'will,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'stored': 0.12; 'archive': 0.14; 'windows': 0.15; '23,': 0.16; 'expects': 0.16; 'format:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it),': 0.16; 'prefix:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'hack': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'point': 0.28; 'feature': 0.29; 'unix': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'too.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'run': 0.32; 'beginning': 0.33; 'minimal': 0.33; 'skip:# 10': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'possible': 0.36; 'should': 0.36; 'application': 0.37; 'easily': 0.37; 'depends': 0.38; 'pm,': 0.38; 'rather': 0.38; 'short': 0.38; 'how': 0.40; 'even': 0.60; 'then,': 0.60; 'most': 0.60; "you're": 0.61; 'zip': 0.64; 'here': 0.66; 'nobody': 0.68; 'jul': 0.74; 'front.': 0.84; 'line!': 0.84; 'to:none': 0.92; 'archive.': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=h0eRLfJY3+PAD+SfuQplAT/3Bev0ZKxnNoSfv56s73s=; b=w4CKE+AdBWaIQS13Skc4WIjRoJpYmGxGJyQvdc6cOFarcnJ6EQ1+xEdabfBY8Ae0nj 9wGoNbsUrxeP3aRwNSAL1h1dkw0EsjRlm7XW+kgfgkfv6MTTeGT/h++Fzgib/hxt1EXD P8UZfag1HCprYFVww+CPr7pib5EBW25edqtJVPbQiF+2RLAHWk/QualjXGciMSb++ObM OGAPmT9Dis96HOIv0m93QBrBsr1kL5W4SyK2RqYSRq8ZEMkaxpWoTGgrGkTtFPAzB0jr PZ9STyJiJ64MEUDHiOeMKMKrnyRZQp8iH8ybln0BoeYy+rZEOKFtjFTm6k7r56n9JSwS BvPw==
MIME-Version 1.0
X-Received by 10.220.195.67 with SMTP id eb3mr48021633vcb.30.1406102392434; Wed, 23 Jul 2014 00:59:52 -0700 (PDT)
In-Reply-To <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
References <53cf38c2$0$29897$c3e8da3$5496439d@news.astraweb.com>
Date Wed, 23 Jul 2014 17:59:52 +1000
Subject Re: Distributing python applications as a zip file
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.12224.1406102395.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1406102395 news.xs4all.nl 2902 [2001:888:2000:d::a6]:55900
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:75068

Show key headers only | 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