From 864333d6869d2c93840316879f5735d5b92a1a5d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 2 Oct 2016 00:43:06 +0200 Subject: [PATCH] pyinstaller: use a spec file to build borg.exe binary also: exclude osxfuse dylib on Mac OS X --- Vagrantfile | 2 +- scripts/borg.exe.spec | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 scripts/borg.exe.spec diff --git a/Vagrantfile b/Vagrantfile index ef38aa94a..60f1b02a8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -263,7 +263,7 @@ def build_binary_with_pyinstaller(boxname) cd /vagrant/borg . borg-env/bin/activate cd borg - pyinstaller -F -n borg.exe --distpath=/vagrant/borg --clean borg/__main__.py + pyinstaller --clean --distpath=/vagrant/borg scripts/borg.exe.spec EOF end diff --git a/scripts/borg.exe.spec b/scripts/borg.exe.spec new file mode 100644 index 000000000..9834c1b8e --- /dev/null +++ b/scripts/borg.exe.spec @@ -0,0 +1,38 @@ +# -*- mode: python -*- +# this pyinstaller spec file is used to build borg binaries on posix platforms + +import os, sys + +basepath = '/vagrant/borg/borg' + +block_cipher = None + +a = Analysis([os.path.join(basepath, 'borg/__main__.py'), ], + pathex=[basepath, ], + binaries=[], + datas=[], + hiddenimports=['borg.platform.posix'], + hookspath=[], + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher) + +if sys.platform == 'darwin': + # do not bundle the osxfuse libraries, so we do not get a version + # mismatch to the installed kernel driver of osxfuse. + a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]] + +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + name='borg.exe', + debug=False, + strip=False, + upx=True, + console=True )