mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 22:00:00 +10:00
Build-Binary: Add optional --reset_binaries arg
This commit is contained in:
@@ -16,7 +16,7 @@ jobs:
|
|||||||
commitdate: ${{ github.event.head_commit.timestamp }}
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --branch ${{ env.branch }} --commit ${{ env.commiturl }} --commit_date ${{ env.commitdate }}
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --reset_binaries --branch ${{ env.branch }} --commit ${{ env.commiturl }} --commit_date ${{ env.commitdate }}
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; ditto -c -k --sequesterRsrc --keepParent OpenCore-Patcher.app ../OpenCore-Patcher-wxPython.app.zip
|
- run: cd dist; ditto -c -k --sequesterRsrc --keepParent OpenCore-Patcher.app ../OpenCore-Patcher-wxPython.app.zip
|
||||||
- run: ./../sign-wxpython.sh
|
- run: ./../sign-wxpython.sh
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
commitdate: ${{ github.event.head_commit.timestamp }}
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --build_tui --branch ${{ env.branch }} --commit ${{ env.commiturl }} --commit_date ${{ env.commitdate }}
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Build-Binary.command --build_tui --reset_binaries --branch ${{ env.branch }} --commit ${{ env.commiturl }} --commit_date ${{ env.commitdate }}
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
||||||
- run: ./../sign-tui.sh
|
- run: ./../sign-tui.sh
|
||||||
|
|||||||
+27
-6
@@ -43,11 +43,11 @@ class create_binary:
|
|||||||
parser.add_argument('--branch', type=str, help='Git branch name')
|
parser.add_argument('--branch', type=str, help='Git branch name')
|
||||||
parser.add_argument('--commit', type=str, help='Git commit URL')
|
parser.add_argument('--commit', type=str, help='Git commit URL')
|
||||||
parser.add_argument('--commit_date', type=str, help='Git commit date')
|
parser.add_argument('--commit_date', type=str, help='Git commit date')
|
||||||
|
parser.add_argument('--reset_binaries', action='store_true', help='Force redownload and imaging of payloads')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def setup_pathing(self):
|
def setup_pathing(self):
|
||||||
# /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
|
|
||||||
python_path = sys.executable
|
python_path = sys.executable
|
||||||
python_binary = python_path.split("/")[-1]
|
python_binary = python_path.split("/")[-1]
|
||||||
python_bin_dir = python_path.strip(python_binary)
|
python_bin_dir = python_path.strip(python_binary)
|
||||||
@@ -56,7 +56,6 @@ class create_binary:
|
|||||||
if not Path(pyinstaller_path).exists():
|
if not Path(pyinstaller_path).exists():
|
||||||
print(f" - pyinstaller not found:\n\t{pyinstaller_path}")
|
print(f" - pyinstaller not found:\n\t{pyinstaller_path}")
|
||||||
raise Exception("pyinstaller not found")
|
raise Exception("pyinstaller not found")
|
||||||
print(f" - pyinstaller found:\n\t{pyinstaller_path}")
|
|
||||||
|
|
||||||
self.pyinstaller_path = pyinstaller_path
|
self.pyinstaller_path = pyinstaller_path
|
||||||
|
|
||||||
@@ -110,8 +109,19 @@ class create_binary:
|
|||||||
|
|
||||||
for resource in required_resources:
|
for resource in required_resources:
|
||||||
if Path(f"./payloads/{resource}").exists():
|
if Path(f"./payloads/{resource}").exists():
|
||||||
print(f" - {resource} already exists, skipping download")
|
if self.args.reset_binaries:
|
||||||
continue
|
print(f" - Removing old {resource}")
|
||||||
|
rm_output = subprocess.run(
|
||||||
|
["rm", "-rf", f"./payloads/{resource}"],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
if rm_output.returncode != 0:
|
||||||
|
print("- Remove failed")
|
||||||
|
print(rm_output.stderr.decode('utf-8'))
|
||||||
|
raise Exception("Remove failed")
|
||||||
|
else:
|
||||||
|
print(f" - {resource} already exists, skipping download")
|
||||||
|
continue
|
||||||
print(f" - Downloading {resource}...")
|
print(f" - Downloading {resource}...")
|
||||||
|
|
||||||
download_result = subprocess.run(
|
download_result = subprocess.run(
|
||||||
@@ -139,8 +149,19 @@ class create_binary:
|
|||||||
|
|
||||||
def generate_paylods_dmg(self):
|
def generate_paylods_dmg(self):
|
||||||
if Path("./payloads.dmg").exists():
|
if Path("./payloads.dmg").exists():
|
||||||
print(" - payloads.dmg already exists, skipping creation")
|
if self.args.reset_binaries:
|
||||||
return
|
print(" - Removing old payloads.dmg")
|
||||||
|
rm_output = subprocess.run(
|
||||||
|
["rm", "-rf", "./payloads.dmg"],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
if rm_output.returncode != 0:
|
||||||
|
print("- Remove failed")
|
||||||
|
print(rm_output.stderr.decode('utf-8'))
|
||||||
|
raise Exception("Remove failed")
|
||||||
|
else:
|
||||||
|
print(" - payloads.dmg already exists, skipping creation")
|
||||||
|
return
|
||||||
print(" - Generating DMG...")
|
print(" - Generating DMG...")
|
||||||
dmg_output = subprocess.run([
|
dmg_output = subprocess.run([
|
||||||
'hdiutil', 'create', './payloads.dmg',
|
'hdiutil', 'create', './payloads.dmg',
|
||||||
|
|||||||
@@ -76,10 +76,11 @@ The main goal of generating prebuilt binaries is to strip the requirement of a l
|
|||||||
pip3 install pyinstaller
|
pip3 install pyinstaller
|
||||||
# Move into project directory
|
# Move into project directory
|
||||||
cd ~/Developer/OpenCore-Legacy-Patcher/
|
cd ~/Developer/OpenCore-Legacy-Patcher/
|
||||||
# Create the pyinstaller based Application (replace OpenCore-Patcher.spec with OpenCore-Patcher-GUI.spec for GUI binary)
|
# Create the pyinstaller based Application
|
||||||
pyinstaller OpenCore-Patcher.spec
|
# Optional Arguments
|
||||||
# Post PyInstaller clean up (only for the TUI)
|
# '--build_tui': Create TUI vairant
|
||||||
./after_pyinstaller.sh
|
# '--reset_binaries': Redownload and generate support files
|
||||||
|
python3 Build-Binary.command
|
||||||
# Open build folder
|
# Open build folder
|
||||||
open ./dist/
|
open ./dist/
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user