OpenCore-Patcher-GUI.spec: Add type hinting for PyInstaller classes

This commit is contained in:
Mykola Grymalyuk
2023-12-30 12:44:28 -07:00
parent 6aa0ab2161
commit e57247a233
+23 -7
View File
@@ -1,16 +1,28 @@
# -*- mode: python ; coding: utf-8 -*-
import sys, os, time, subprocess, pathlib
import os
import sys
import time
import subprocess
from pathlib import Path
from PyInstaller.building.api import PYZ, EXE, COLLECT
from PyInstaller.building.osx import BUNDLE
from PyInstaller.building.build_main import Analysis
sys.path.append(os.path.abspath(os.getcwd()))
from resources import constants
block_cipher = None
datas = [
('payloads.dmg', '.'),
('Universal-Binaries.dmg', '.'),
]
if pathlib.Path("DortaniaInternalResources.dmg").exists():
if Path("DortaniaInternalResources.dmg").exists():
datas.append(('DortaniaInternalResources.dmg', '.'))
@@ -27,8 +39,10 @@ a = Analysis(['OpenCore-Patcher-GUI.command'],
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
pyz = PYZ(a.pure,
a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
@@ -43,7 +57,8 @@ exe = EXE(pyz,
disable_windowed_traceback=False,
target_arch="universal2",
codesign_identity=None,
entitlements_file=None )
entitlements_file=None)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
@@ -52,6 +67,7 @@ coll = COLLECT(exe,
upx=True,
upx_exclude=[],
name='OpenCore-Patcher')
app = BUNDLE(coll,
name='OpenCore-Patcher.app',
icon="payloads/OC-Patcher.icns",
@@ -64,6 +80,6 @@ app = BUNDLE(coll,
"NSRequiresAquaSystemAppearance": False,
"NSHighResolutionCapable": True,
"Build Date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
"BuildMachineOSBuild": subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().strip(),
"BuildMachineOSBuild": subprocess.run(["/usr/bin/sw_vers", "-buildVersion"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().strip(),
"NSPrincipalClass": "NSApplication",
})