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,16 +18,33 @@ 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)
if '--onefile' in sys.argv or '-F' in sys.argv:
exe = EXE(pyz, exe = EXE(pyz,
a.scripts, a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[], [],
exclude_binaries=True, name='deemix-server',
name='deemix_webui',
debug=False, debug=False,
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
upx=True, upx=True,
console=True ) upx_exclude=[],
runtime_tmpdir=None,
console=True , icon='icon.ico')
else:
exe = EXE(pyz,
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, coll = COLLECT(exe,
a.binaries, a.binaries,
a.zipfiles, a.zipfiles,
@ -37,4 +52,4 @@ coll = COLLECT(exe,
strip=False, strip=False,
upx=True, upx=True,
upx_exclude=[], upx_exclude=[],
name='server') name='deemix-server')