Rob Austein d357e02b5d Try telling BlackFriday to use text mode. | 5 anos atrás | |
---|---|---|
demo1 | 5 anos atrás | |
demo2 | 5 anos atrás | |
.gitignore | 5 anos atrás | |
Makefile | 5 anos atrás | |
README.md | 5 anos atrás | |
pyzipper | 5 anos atrás |
A small tool to package up a Python program and associated data files as a single executable zip file.
All the facilities for this are already built into Python, this script just ties it all together with a bow.
demo1
and demo2
are two trivial sample packages.
The Makefile
is just a driver for the demos. pyzipper
itself is
all you need if you want to use this yourself.
Tested with both Python 2 and Python 3, should work with either.
This relies on two somewhat obscure Python features:
The zipfile.PyZipFile
class's ability to construct an executable
ZIP file and populate it with Python modules, packages, and data;
and
Python's ability to treat a zip file as equivalent to a directory
tree on import
.
demo1
takes advantage of a third obscure feature: the pkgutil
library's ability to load data files via the import
system.
This is what pyzipper --help
returns as of this writing. The
program itself is authoritative, this is just a snapshot for
convenience.
usage: pyzipper [-h] -o OUTPUT [-m MODULE] [-e EXECUTABLE] source
Generate an executable Python zip package.
positional arguments:
source
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
-m MODULE, --module MODULE
module within package to run (default: main)
-e EXECUTABLE, --executable EXECUTABLE
python executable to run (default: python)