Added support for --onefile on spec files

This commit is contained in:
RemixDev 2020-09-08 14:18:21 +02:00
parent 326ea8a112
commit 79ff9ba88e
2 changed files with 53 additions and 25 deletions

View file

@ -1,7 +1,5 @@
# -*- mode: python ; coding: utf-8 -*- # -*- mode: python ; coding: utf-8 -*-
import deemix
import sys import sys
from os.path import dirname
block_cipher = None block_cipher = None
@ -31,7 +29,7 @@ if sys.platform.startswith('darwin'):
strip=False, strip=False,
upx=True, upx=True,
console=False, console=False,
icon=f"icon.icns") icon="icon.icns")
coll = COLLECT(exe, coll = COLLECT(exe,
a.binaries, a.binaries,
a.zipfiles, a.zipfiles,
@ -44,6 +42,21 @@ if sys.platform.startswith('darwin'):
name='deemix-pyweb.app', name='deemix-pyweb.app',
icon="icon.icns", icon="icon.icns",
bundle_identifier=None) bundle_identifier=None)
elif '--onefile' in sys.argv or '-F' in sys.argv:
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='deemix-pyweb',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False , icon='icon.ico')
else: else:
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,
@ -55,7 +68,7 @@ else:
strip=False, strip=False,
upx=True, upx=True,
console=False, console=False,
icon=f"icon.ico") icon="icon.ico")
coll = COLLECT(exe, coll = COLLECT(exe,
a.binaries, a.binaries,
a.zipfiles, a.zipfiles,

View file

@ -1,7 +1,5 @@
# -*- mode: python ; coding: utf-8 -*- # -*- mode: python ; coding: utf-8 -*-
import deemix
import sys import sys
from os.path import dirname
block_cipher = None block_cipher = None
@ -9,7 +7,7 @@ sys.modules['FixTk'] = None
a = Analysis(['server.py'], a = Analysis(['server.py'],
binaries=[], binaries=[],
datas=[('webui/public', 'webui')], datas=[('webui/public', 'webui'), ('icon.ico', '.')],
hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'], hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'],
hookspath=[], hookspath=[],
runtime_hooks=[], runtime_hooks=[],
@ -20,21 +18,38 @@ a = Analysis(['server.py'],
noarchive=False) noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher) cipher=block_cipher)
exe = EXE(pyz, if '--onefile' in sys.argv or '-F' in sys.argv:
a.scripts, exe = EXE(pyz,
[], a.scripts,
exclude_binaries=True, a.binaries,
name='deemix_webui', a.zipfiles,
debug=False, a.datas,
bootloader_ignore_signals=False, [],
strip=False, name='deemix-server',
upx=True, debug=False,
console=True ) bootloader_ignore_signals=False,
coll = COLLECT(exe, strip=False,
a.binaries, upx=True,
a.zipfiles, upx_exclude=[],
a.datas, runtime_tmpdir=None,
strip=False, console=True , icon='icon.ico')
upx=True, else:
upx_exclude=[], exe = EXE(pyz,
name='server') a.scripts,
[],
exclude_binaries=True,
name='deemix-server',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
icon="icon.ico")
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='deemix-server')