From 79ff9ba88e6e93a86f897d8956c371b01ca9fdaf Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 8 Sep 2020 14:18:21 +0200 Subject: [PATCH] Added support for --onefile on spec files --- deemix-pyweb.spec | 21 +++++++++++++---- server.spec | 57 ++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/deemix-pyweb.spec b/deemix-pyweb.spec index 7e477e7..2537b58 100644 --- a/deemix-pyweb.spec +++ b/deemix-pyweb.spec @@ -1,7 +1,5 @@ # -*- mode: python ; coding: utf-8 -*- -import deemix import sys -from os.path import dirname block_cipher = None @@ -31,7 +29,7 @@ if sys.platform.startswith('darwin'): strip=False, upx=True, console=False, - icon=f"icon.icns") + icon="icon.icns") coll = COLLECT(exe, a.binaries, a.zipfiles, @@ -44,6 +42,21 @@ if sys.platform.startswith('darwin'): name='deemix-pyweb.app', icon="icon.icns", 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: exe = EXE(pyz, a.scripts, @@ -55,7 +68,7 @@ else: strip=False, upx=True, console=False, - icon=f"icon.ico") + icon="icon.ico") coll = COLLECT(exe, a.binaries, a.zipfiles, diff --git a/server.spec b/server.spec index 61abddd..54deb1c 100644 --- a/server.spec +++ b/server.spec @@ -1,7 +1,5 @@ # -*- mode: python ; coding: utf-8 -*- -import deemix import sys -from os.path import dirname block_cipher = None @@ -9,7 +7,7 @@ sys.modules['FixTk'] = None a = Analysis(['server.py'], binaries=[], - datas=[('webui/public', 'webui')], + datas=[('webui/public', 'webui'), ('icon.ico', '.')], hiddenimports=['engineio.async_drivers.threading', 'pkg_resources.py2_warn'], hookspath=[], runtime_hooks=[], @@ -20,21 +18,38 @@ a = Analysis(['server.py'], noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) -exe = EXE(pyz, - a.scripts, - [], - exclude_binaries=True, - name='deemix_webui', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=True ) -coll = COLLECT(exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='server') +if '--onefile' in sys.argv or '-F' in sys.argv: + exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='deemix-server', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=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, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='deemix-server')