diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-23 00:01:17 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-23 00:01:17 -0400 |
commit | 4e4a118c4c441c41cbe50f6f0a2991690ed1bc5c (patch) | |
tree | 2c102054852c83fc35efa1152f387599ea97534e /setup.py | |
parent | 931ebeabf4a378b303f6868d34ca66b433d28188 (diff) | |
download | python-termcast-client-4e4a118c4c441c41cbe50f6f0a2991690ed1bc5c.tar.gz python-termcast-client-4e4a118c4c441c41cbe50f6f0a2991690ed1bc5c.zip |
allow creating distributable binaries
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -1,5 +1,29 @@ +import sys + from setuptools import setup, find_packages +if len(sys.argv) > 1 and sys.argv[1] == "fatpack": + import glob + import io + import zipfile + + zipdata = io.BytesIO() + z = zipfile.ZipFile(zipdata, mode="w", compression=zipfile.ZIP_DEFLATED) + for filename in glob.iglob("termcast_client/*.py"): + if filename[-11:] == "__main__.py": + arcname = "__main__.py" + else: + arcname = filename + with open(filename, "rb") as f: + z.write(filename, arcname=arcname) + z.close() + + with open("termcast", "wb") as f: + f.write(b"#!/usr/bin/env python\n") + f.write(zipdata.getvalue()) + + sys.exit() + setup( name="termcast_client", version="0.1.0", |