commit 3e135228750d6ce50646c5d5a716db92d41fe8e7 Author: Alexandre Allaire alexandre.allaire@mail.mcgill.ca Date: Mon Nov 26 09:53:52 2012 -0800
Adding PyInstaller spec file for client programs.
This commit implements changes requested in the second comment for trac ticket 7283.
- Spec file added for client programs, they are now bundled with one invocation of PyInstaller.
- Make target for windows deployment is now called dist-exe, produces dist/flashproxy-client-VERSION-win32.zip. Cleans up PyInstaller log and build files after. Produces an error if PyInstaller cannot bundle M2Crypto. --- Makefile | 25 +++++++++++++------------ flashproxy-client.spec | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile index fdf5832..3dfb8e1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ MANDIR = $(PREFIX)/share/man
PYTHON = python PYINSTALLER_PY = ../pyinstaller-2.0/pyinstaller.py - +export PYINSTALLER_TMPDIR = pyi VERSION = 0.8
CLIENT_BIN = flashproxy-client flashproxy-reg-email flashproxy-reg-http @@ -53,16 +53,17 @@ sign: dist/$(DISTNAME).zip cd dist && gpg --sign --detach-sign --armor $(DISTNAME).zip cd dist && gpg --verify $(DISTNAME).zip.asc $(DISTNAME).zip
-exe: $(CLIENT_BIN) - rm -rf $(DISTDIR) - mkdir -p $(DISTDIR) - for file in $(CLIENT_BIN); \ - do \ - $(PYTHON) $(PYINSTALLER_PY) --onedir $$file; \ - cp dist/$$file/* $(DISTDIR); \ - mv $(DISTDIR)/$$file.exe $(DISTDIR)/$$file; \ - rm -rf dist/$$file; \ - done - mv $(DISTDIR)/M2Crypto.__m2crypto.pyd $(DISTDIR)/__m2crypto.pyd +dist-exe: $(CLIENT_BIN) + rm -rf $(DISTDIR)-win32 + mkdir -p $(DISTDIR)-win32 + mkdir $(DISTDIR)-win32/doc + $(PYTHON) $(PYINSTALLER_PY) --buildpath=$(PYINSTALLER_TMPDIR)/build flashproxy-client.spec 2>&1 \ + | grep "ERROR"; [ $$? == 1 ] + cp -f $(PYINSTALLER_TMPDIR)/dist/* $(DISTDIR)-win32 + cp -f README LICENSE torrc $(DISTDIR)-win32 + cp -f $(CLIENT_DIST_DOC_FILES) $(DISTDIR)-win32/doc + mv $(DISTDIR)-win32/M2Crypto.__m2crypto.pyd $(DISTDIR)-win32/__m2crypto.pyd + cd dist && zip -q -r -9 $(DISTNAME)-win32.zip $(DISTNAME)-win32 + rm -rf logdict* $(PYINSTALLER_TMPDIR)
.PHONY: all install clean test dist sign exe diff --git a/flashproxy-client.spec b/flashproxy-client.spec new file mode 100644 index 0000000..9914932 --- /dev/null +++ b/flashproxy-client.spec @@ -0,0 +1,28 @@ +# +# PyInstaller spec file for the flashproxy client programs. +# Modelled after example at http://www.pyinstaller.org/export/v2.0/project/doc/Manual.html?format=raw#me.... +# + +# Top-level directory. +tmpdir = os.environ['PYINSTALLER_TMPDIR'] +scripts = ('flashproxy-client', 'flashproxy-reg-email', 'flashproxy-reg-http') + +# M2Crypto is listed as hidden import so PyInstaller fails if it cannot find it. +analyses = [(Analysis([script], hiddenimports=['M2Crypto']), + script, + os.path.join(tmpdir, 'build', script + '.exe')) for script in scripts] + +MERGE(*analyses) + +tocs = [] +for a, _, exename in analyses: + pyz = PYZ(a.pure) + tocs.append(EXE(pyz, + a.scripts, + exclude_binaries=1, + console=True, + name=exename)) + tocs.append(a.binaries) + + +COLLECT(*tocs, name=os.path.join(tmpdir, 'dist'))
tor-commits@lists.torproject.org