From 4e4a118c4c441c41cbe50f6f0a2991690ed1bc5c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 23 Sep 2014 00:01:17 -0400 Subject: allow creating distributable binaries --- setup.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index eb437fa..423a70c 100644 --- a/setup.py +++ b/setup.py @@ -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", -- cgit v1.2.3-54-g00ecf