From e57247a2333f39f9706339a9e6fd87502b86b9ac Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 30 Dec 2023 12:44:28 -0700 Subject: [PATCH] OpenCore-Patcher-GUI.spec: Add type hinting for PyInstaller classes --- OpenCore-Patcher-GUI.spec | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/OpenCore-Patcher-GUI.spec b/OpenCore-Patcher-GUI.spec index e87b58e3a..257f4feb6 100644 --- a/OpenCore-Patcher-GUI.spec +++ b/OpenCore-Patcher-GUI.spec @@ -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", })