Rob Austein d357e02b5d Try telling BlackFriday to use text mode. | 5 rokov pred | |
---|---|---|
demo1 | 5 rokov pred | |
demo2 | 5 rokov pred | |
.gitignore | 5 rokov pred | |
Makefile | 5 rokov pred | |
README.md | 5 rokov pred | |
pyzipper | 5 rokov pred |
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)