112 lines
2.6 KiB
Python
112 lines
2.6 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
|
|
import os
|
|
import sys
|
|
|
|
SPEC_DIR = (
|
|
os.path.abspath(os.path.dirname(__file__))
|
|
if "__file__" in globals()
|
|
else os.getcwd()
|
|
)
|
|
if SPEC_DIR not in sys.path:
|
|
sys.path.insert(0, SPEC_DIR)
|
|
|
|
from app_version import APP_NAME, APP_VERSION
|
|
from PyInstaller.utils.win32.versioninfo import (
|
|
VSVersionInfo,
|
|
FixedFileInfo,
|
|
StringFileInfo,
|
|
StringTable,
|
|
StringStruct,
|
|
VarFileInfo,
|
|
VarStruct,
|
|
)
|
|
|
|
|
|
def build_windows_version(version_text):
|
|
parts = [int(part) for part in version_text.split('.') if part.strip()]
|
|
parts = (parts + [0, 0, 0, 0])[:4]
|
|
return tuple(parts)
|
|
|
|
|
|
windows_version = build_windows_version(APP_VERSION)
|
|
windows_version_text = '.'.join(str(part) for part in windows_version)
|
|
|
|
version_info = VSVersionInfo(
|
|
ffi=FixedFileInfo(
|
|
filevers=windows_version,
|
|
prodvers=windows_version,
|
|
mask=0x3F,
|
|
flags=0x0,
|
|
OS=0x40004,
|
|
fileType=0x1,
|
|
subtype=0x0,
|
|
date=(0, 0),
|
|
),
|
|
kids=[
|
|
StringFileInfo(
|
|
[
|
|
StringTable(
|
|
'080404B0',
|
|
[
|
|
StringStruct('CompanyName', 'Moka'),
|
|
StringStruct('FileDescription', APP_NAME),
|
|
StringStruct('FileVersion', windows_version_text),
|
|
StringStruct('InternalName', 'pqAutomationApp'),
|
|
StringStruct('OriginalFilename', 'pqAutomationApp.exe'),
|
|
StringStruct('ProductName', APP_NAME),
|
|
StringStruct('ProductVersion', windows_version_text),
|
|
],
|
|
)
|
|
]
|
|
),
|
|
VarFileInfo([VarStruct('Translation', [2052, 1200])]),
|
|
],
|
|
)
|
|
|
|
|
|
a = Analysis(
|
|
['pqAutomationApp.py'],
|
|
pathex=[],
|
|
binaries=[],
|
|
datas=[('assets', 'assets'), ('UniTAP', 'UniTAP')],
|
|
hiddenimports=[],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
runtime_hooks=[],
|
|
excludes=['PyQt5'],
|
|
noarchive=False,
|
|
optimize=0,
|
|
)
|
|
pyz = PYZ(a.pure)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
[],
|
|
exclude_binaries=True,
|
|
name='pqAutomationApp',
|
|
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,
|
|
contents_directory='internal',
|
|
version=version_info,
|
|
icon=os.path.join(SPEC_DIR, 'assets', 'pq.ico'),
|
|
)
|
|
coll = COLLECT(
|
|
exe,
|
|
a.binaries,
|
|
a.datas,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
name='pqAutomationApp',
|
|
)
|