1# -*- mode: python -*-
2# this pyinstaller spec file is used to build borg binaries on posix platforms
3
4import os, sys
5
6# Note: SPEC contains the spec file argument given to pyinstaller
7here = os.path.dirname(os.path.abspath(SPEC))
8basepath = os.path.abspath(os.path.join(here, '..'))
9
10block_cipher = None
11
12a = Analysis([os.path.join(basepath, 'src/borg/__main__.py'), ],
13             pathex=[basepath, ],
14             binaries=[],
15             datas=[
16                 ('../src/borg/paperkey.html', 'borg'),
17             ],
18             hiddenimports=['borg.platform.posix'],
19             hookspath=[],
20             runtime_hooks=[],
21             excludes=[
22                '_ssl', 'ssl',
23             ],
24             win_no_prefer_redirects=False,
25             win_private_assemblies=False,
26             cipher=block_cipher)
27
28if sys.platform == 'darwin':
29    # do not bundle the osxfuse libraries, so we do not get a version
30    # mismatch to the installed kernel driver of osxfuse.
31    a.binaries = [b for b in a.binaries if 'libosxfuse' not in b[0]]
32
33pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
34
35exe = EXE(pyz,
36          a.scripts,
37          a.binaries,
38          a.zipfiles,
39          a.datas,
40          name='borg.exe',
41          debug=False,
42          strip=False,
43          upx=True,
44          console=True )
45
46# Build a directory-based binary in addition to a packed
47# single file. This allows one to easily look at all included
48# files (e.g. without having to strace or halt the built binary
49# and introspect /tmp). Also avoids unpacking all libs when
50# running the app, which is better for app signing on various OS.
51slim_exe = EXE(pyz,
52            a.scripts,
53            exclude_binaries=True,
54            name='borg.exe',
55            debug=False,
56            strip=False,
57            upx=False,
58            console=True)
59
60coll = COLLECT(slim_exe,
61                a.binaries,
62                a.zipfiles,
63                a.datas,
64                strip=False,
65                upx=False,
66                name='borg-dir')
67