diff --git a/.gitignore b/.gitignore index 7acd6d7..57b9994 100644 --- a/.gitignore +++ b/.gitignore @@ -24,12 +24,6 @@ var/ MANIFEST .eggs -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/pyi/build-exe b/pyi/build-exe new file mode 100755 index 0000000..5c1b347 --- /dev/null +++ b/pyi/build-exe @@ -0,0 +1,17 @@ +#!/bin/sh + +# use pyinstaller to build a single-file "fat binary" called wormhole.exe. +# +# the .exe here does NOT mean a windows executable, but an executable in general. +# +# "fat binary" means it includes the python interpreter, the python source code +# and libs, compiled code parts and externally needed (C/compiled) libraries. +# it does NOT include the (g)libc though as this needs to be provided by the +# target platform and needs to match the kernel there. thus, it is a good idea +# to run the build on an old, but still security-supported linux (or other posix +# OS) to keep the minimum (g)libc requirement low. + +pyinstaller --clean --distpath=dist wormhole.exe.spec + +# result will be in dist/wormhole.exe + diff --git a/pyi/wormhole.exe.spec b/pyi/wormhole.exe.spec new file mode 100644 index 0000000..9fb6a9f --- /dev/null +++ b/pyi/wormhole.exe.spec @@ -0,0 +1,43 @@ +# -*- mode: python -*- +# this pyinstaller spec file is used to build wormhole binaries on posix platforms + +import os, sys + +# your cwd should be in the same dir as this file, so .. is the project directory: +basepath = os.path.realpath('..') + +a = Analysis([os.path.join(basepath, 'src/wormhole/__main__.py'), ], + pathex=[basepath, ], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=None) + +pyz = PYZ(a.pure, a.zipped_data, cipher=None) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + name='wormhole.exe', + debug=False, + strip=False, + upx=True, + console=True) + +if False: + # Enable this block to build a directory-based binary instead of + # a packed single file. + coll = COLLECT(exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + name='wormhole-dir') diff --git a/src/wormhole/__main__.py b/src/wormhole/__main__.py index a47f2e5..d56a7ea 100644 --- a/src/wormhole/__main__.py +++ b/src/wormhole/__main__.py @@ -2,7 +2,7 @@ if __name__ != "__main__": raise ImportError('this module should not be imported') -from .cli import cli +from wormhole.cli import cli cli.wormhole()