diff --git a/.github/workflows/build-app-wxpython.yml b/.github/workflows/build-app-wxpython.yml index 9e7fa7823..a67e5f406 100644 --- a/.github/workflows/build-app-wxpython.yml +++ b/.github/workflows/build-app-wxpython.yml @@ -16,7 +16,7 @@ jobs: commitdate: ${{ github.event.head_commit.timestamp }} steps: - 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: cd dist; ditto -c -k --sequesterRsrc --keepParent OpenCore-Patcher.app ../OpenCore-Patcher-wxPython.app.zip - run: ./../sign-wxpython.sh diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml index fd0d24f73..903c59ece 100644 --- a/.github/workflows/build-app.yml +++ b/.github/workflows/build-app.yml @@ -16,7 +16,7 @@ jobs: commitdate: ${{ github.event.head_commit.timestamp }} steps: - 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: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app - run: ./../sign-tui.sh diff --git a/Build-Binary.command b/Build-Binary.command index 2cbc901bb..af8ddb1a7 100755 --- a/Build-Binary.command +++ b/Build-Binary.command @@ -43,11 +43,11 @@ class create_binary: parser.add_argument('--branch', type=str, help='Git branch name') parser.add_argument('--commit', type=str, help='Git commit URL') 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() return args def setup_pathing(self): - # /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 python_path = sys.executable python_binary = python_path.split("/")[-1] python_bin_dir = python_path.strip(python_binary) @@ -56,7 +56,6 @@ class create_binary: if not Path(pyinstaller_path).exists(): print(f" - pyinstaller not found:\n\t{pyinstaller_path}") raise Exception("pyinstaller not found") - print(f" - pyinstaller found:\n\t{pyinstaller_path}") self.pyinstaller_path = pyinstaller_path @@ -110,8 +109,19 @@ class create_binary: for resource in required_resources: if Path(f"./payloads/{resource}").exists(): - print(f" - {resource} already exists, skipping download") - continue + if self.args.reset_binaries: + 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}...") download_result = subprocess.run( @@ -139,8 +149,19 @@ class create_binary: def generate_paylods_dmg(self): if Path("./payloads.dmg").exists(): - print(" - payloads.dmg already exists, skipping creation") - return + if self.args.reset_binaries: + 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...") dmg_output = subprocess.run([ 'hdiutil', 'create', './payloads.dmg', diff --git a/SOURCE.md b/SOURCE.md index a61a53999..a633a57d5 100644 --- a/SOURCE.md +++ b/SOURCE.md @@ -76,10 +76,11 @@ The main goal of generating prebuilt binaries is to strip the requirement of a l pip3 install pyinstaller # Move into project directory cd ~/Developer/OpenCore-Legacy-Patcher/ -# Create the pyinstaller based Application (replace OpenCore-Patcher.spec with OpenCore-Patcher-GUI.spec for GUI binary) -pyinstaller OpenCore-Patcher.spec -# Post PyInstaller clean up (only for the TUI) -./after_pyinstaller.sh +# Create the pyinstaller based Application +# Optional Arguments +# '--build_tui': Create TUI vairant +# '--reset_binaries': Redownload and generate support files +python3 Build-Binary.command # Open build folder open ./dist/ ```