mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 08:48:13 +00:00
120 lines
2.7 KiB
Python
120 lines
2.7 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
from PyInstaller.utils.hooks import collect_all
|
|
|
|
# - get version from version file
|
|
import os
|
|
import sys
|
|
import platform
|
|
sys.path.insert(0, os.path.abspath('.'))
|
|
from version import APP_NAME, APP_VERSION, APP_AUTHOR
|
|
|
|
datas = [('resources', 'resources'), ('src/engines/blender/scripts/', 'src/engines/blender/scripts')]
|
|
binaries = []
|
|
hiddenimports = ['zeroconf']
|
|
tmp_ret = collect_all('zeroconf')
|
|
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
|
|
|
|
|
|
a = Analysis(
|
|
['main.py'],
|
|
pathex=[],
|
|
binaries=binaries,
|
|
datas=datas,
|
|
hiddenimports=hiddenimports,
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=[],
|
|
noarchive=False,
|
|
optimize=0,
|
|
)
|
|
pyz = PYZ(a.pure)
|
|
|
|
if platform.system() == 'Darwin': # macOS
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
[],
|
|
exclude_binaries=True,
|
|
name=APP_NAME,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
)
|
|
app = BUNDLE(
|
|
exe,
|
|
a.binaries,
|
|
a.datas,
|
|
strip=True,
|
|
name=f'{APP_NAME}.app',
|
|
icon=None,
|
|
bundle_identifier=None,
|
|
version=APP_VERSION
|
|
)
|
|
|
|
elif platform.system() == 'Windows':
|
|
|
|
import pyinstaller_versionfile
|
|
import tempfile
|
|
|
|
version_file_path = os.path.join(tempfile.gettempdir(), 'versionfile.txt')
|
|
|
|
pyinstaller_versionfile.create_versionfile(
|
|
output_file=version_file_path,
|
|
version=APP_VERSION,
|
|
company_name=APP_AUTHOR,
|
|
file_description=APP_NAME,
|
|
internal_name=APP_NAME,
|
|
legal_copyright=f"© {APP_AUTHOR}",
|
|
original_filename=f"{APP_NAME}.exe",
|
|
product_name=APP_NAME
|
|
)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas,
|
|
[],
|
|
name=APP_NAME,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
version=version_file_path
|
|
)
|
|
|
|
else: # linux
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas,
|
|
[],
|
|
name=APP_NAME,
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None
|
|
)
|