1
0
Fork 0
mirror of https://github.com/borgbase/vorta synced 2024-12-22 07:43:09 +00:00

pyinstaller / vorta.spec: make platform independent (#122)

* pyinstaller / vorta.spec: make platform independent

- cwd must be the repo dir, __FILE__ is not available here
- the borg binary for the platform must be in bin/borg (no matter
  whether we build for Linux or macOS or ...)
- moved some settings to top of the file
- whitespace clean up

* fat binary: must not fork on linux either

also: refactor slightly
This commit is contained in:
TW 2019-01-13 03:03:00 +01:00 committed by Manuel Riel
parent c5494f455c
commit d2f618babf
3 changed files with 30 additions and 21 deletions

View file

@ -15,10 +15,9 @@ def main():
args = parse_args()
frozen_binary = getattr(sys, 'frozen', False)
# Don't fork if user specifies it or when running from onedir app bundle on macOS.
if (hasattr(args, 'foreground') and args.foreground) or (frozen_binary and sys.platform == 'darwin'):
pass
else:
need_foreground = frozen_binary and sys.platform in ('darwin', 'linux')
want_foreground = getattr(args, 'foreground', False)
if not (want_foreground or need_foreground):
print('Forking to background (see system tray).')
if os.fork():
sys.exit()

View file

@ -1,27 +1,37 @@
# -*- mode: python -*-
block_cipher = None
import os
CREATE_VORTA_DIR = False # create dist/vorta-dir/ output?
BLOCK_CIPHER = None
# it is assumed that the cwd is the git repo dir:
REPO_DIR = os.path.abspath('.')
SRC_DIR = os.path.join(REPO_DIR, 'src')
a = Analysis(['src/vorta/__main__.py'],
pathex=['/Users/manu/Workspace/vorta/src'],
pathex=[SRC_DIR],
binaries=[
('bin/macosx64/borg', 'bin'),
('bin/borg', 'bin'), # (<borg fat binary for this platform>, <dest. folder>)
],
datas=[
('src/vorta/assets/UI/*', 'assets/UI'),
('src/vorta/assets/icons/*', 'assets/icons'),
],
hiddenimports=['vorta.views.collection_rc',
hiddenimports=[
'vorta.views.collection_rc',
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
cipher=BLOCK_CIPHER,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data, cipher=BLOCK_CIPHER)
exe = EXE(pyz,
a.scripts,
a.binaries,
@ -46,10 +56,10 @@ app = BUNDLE(exe,
'CFBundleShortVersionString': '0.6.4',
'CFBundleVersion': '0.6.4',
'NSAppleEventsUsageDescription': 'Please allow',
'SUFeedURL': 'https://borgbase.github.io/vorta/appcast.xml'
},
)
if False:
'SUFeedURL': 'https://borgbase.github.io/vorta/appcast.xml',
})
if CREATE_VORTA_DIR:
coll = COLLECT(exe,
a.binaries,
a.zipfiles,