From cee4e1e6459642bac48c7712987750fcd5a69655 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 11:22:49 +0100 Subject: [PATCH 1/7] Add patch for Pyinstaller bug (CQ-1519) --- build_conquest_python.py | 7 +++++++ pyinstaller.patch | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 pyinstaller.patch diff --git a/build_conquest_python.py b/build_conquest_python.py index a58fd3a..b0ce806 100755 --- a/build_conquest_python.py +++ b/build_conquest_python.py @@ -758,6 +758,13 @@ def main(): "fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'"), ) + # Patch Pyinstaller to fix https://github.com/pyinstaller/pyinstaller/issues/5540 + # The actual fix for this isn't in any of the 3.x versions, and 4.x onwards require Python 3 :( + if Package().linux: + command = ["patch", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")] + package_path = ConquestPythonPackage().python_base_directory / 'lib' / 'python2.7' / 'site-packages' + subprocess.run(command, cwd=package_path) + if not Package().windows: bdb_env = dict(os.environ) bdb_env['BERKELEYDB_DIR'] = f'{ConquestPythonPackage().python_base_directory}' diff --git a/pyinstaller.patch b/pyinstaller.patch new file mode 100644 index 0000000..d6c37f1 --- /dev/null +++ b/pyinstaller.patch @@ -0,0 +1,13 @@ +diff --git a/PyInstaller/depend/utils.py b/PyInstaller/depend/utils.py +index 4776676b7..eca1e9dd8 100644 +--- a/PyInstaller/depend/utils.py ++++ b/PyInstaller/depend/utils.py +@@ -372,6 +372,8 @@ def load_ldconfig_cache(): + for line in text: + # :fixme: this assumes libary names do not contain whitespace + m = pattern.match(line) ++ if m is None: ++ continue + path = m.groups()[-1] + if is_freebsd: + # Insert `.so` at the end of the lib's basename. soname From 9173a5a822c38d277890f97a42eed11a49271aa5 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 11:25:15 +0100 Subject: [PATCH 2/7] Fix args for patch command (CQ-1519) --- build_conquest_python.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_conquest_python.py b/build_conquest_python.py index b0ce806..fc30afc 100755 --- a/build_conquest_python.py +++ b/build_conquest_python.py @@ -761,7 +761,7 @@ def main(): # Patch Pyinstaller to fix https://github.com/pyinstaller/pyinstaller/issues/5540 # The actual fix for this isn't in any of the 3.x versions, and 4.x onwards require Python 3 :( if Package().linux: - command = ["patch", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")] + command = ["patch", "-i", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")] package_path = ConquestPythonPackage().python_base_directory / 'lib' / 'python2.7' / 'site-packages' subprocess.run(command, cwd=package_path) From 06baa9ae9accff9bd644df1e97c51b95ef8f9fdd Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 16:36:42 +0100 Subject: [PATCH 3/7] Fix patch command and ensure patch is installed (CQ-1519) --- .github/workflows/build-conquest-python.yml | 10 ++++++++++ build_conquest_python.py | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index 6d2cc42..a0f56e8 100644 --- a/.github/workflows/build-conquest-python.yml +++ b/.github/workflows/build-conquest-python.yml @@ -81,6 +81,16 @@ jobs: ${{ needs.setup.outputs.python }} --version ${{ needs.setup.outputs.python }} -m pip install --upgrade pip wheel setuptools + - name: Install patch + run: | + if [[ "${{ needs.setup.outputs.runson }}" == "ubuntu-latest" ]]; then + if [[ -f /etc/rocky-release ]]; then + sudo dnf install -y patch + else + sudo apt update && sudo apt install -y patch + fi + fi + - name: Build conquest python run: | output=$(${{ needs.setup.outputs.python }} build_conquest_python.py | grep Creating | tail -n 1) diff --git a/build_conquest_python.py b/build_conquest_python.py index fc30afc..8b8ec27 100755 --- a/build_conquest_python.py +++ b/build_conquest_python.py @@ -761,8 +761,9 @@ def main(): # Patch Pyinstaller to fix https://github.com/pyinstaller/pyinstaller/issues/5540 # The actual fix for this isn't in any of the 3.x versions, and 4.x onwards require Python 3 :( if Package().linux: - command = ["patch", "-i", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")] - package_path = ConquestPythonPackage().python_base_directory / 'lib' / 'python2.7' / 'site-packages' + command = ["patch", "-p1", "-i", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")] + print(f"Applying patch with {' '.join(command)}") + package_path = ConquestPythonPackage().python_base_directory / "lib" / "python2.7" / "site-packages" subprocess.run(command, cwd=package_path) if not Package().windows: From 14d14a5fac2fdfef8e586d13ab6fae5a0c772291 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 16:37:23 +0100 Subject: [PATCH 4/7] Remove duplicate Rocky setup (NO_JIRA) --- .github/workflows/build-conquest-python.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index a0f56e8..60a9147 100644 --- a/.github/workflows/build-conquest-python.yml +++ b/.github/workflows/build-conquest-python.yml @@ -51,11 +51,6 @@ jobs: echo python=python >> $GITHUB_OUTPUT fi - # Build the conquest python for rocky8 - echo runson=ubuntu-latest >> $GITHUB_OUTPUT - echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT - echo python=python3 >> $GITHUB_OUTPUT - build-upload: needs: - setup From 69b975c95826abffce73fd4e2d82b8212bc3fed3 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 16:43:04 +0100 Subject: [PATCH 5/7] Default to building ConQuest python on Rocky (CQ-1519) --- .github/workflows/build-conquest-python.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index 60a9147..f00095b 100644 --- a/.github/workflows/build-conquest-python.yml +++ b/.github/workflows/build-conquest-python.yml @@ -36,11 +36,7 @@ jobs: - name: Set output id: set_output run: | - if [[ "${{ inputs.platforms }}" == "rocky8" ]]; then - echo runson=ubuntu-latest >> $GITHUB_OUTPUT - echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT - echo python=python3 >> $GITHUB_OUTPUT - elif [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then + if [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then echo runson=ubuntu-latest >> $GITHUB_OUTPUT echo python=python3 >> $GITHUB_OUTPUT elif [[ "${{ inputs.platforms }}" == "macos" ]]; then @@ -49,6 +45,11 @@ jobs: elif [[ "${{ inputs.platforms }}" == "windows" ]]; then echo runson=windows-2019 >> $GITHUB_OUTPUT echo python=python >> $GITHUB_OUTPUT + else + # default to Rocky + echo runson=ubuntu-latest >> $GITHUB_OUTPUT + echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT + echo python=python3 >> $GITHUB_OUTPUT fi build-upload: From fffff046730f06af01f1be8094e30f1582281f75 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 18:07:58 +0100 Subject: [PATCH 6/7] Store builds as an artifact with a short lifetime for PRs (CQ-1915) --- .github/workflows/build-conquest-python.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index f00095b..901c2e1 100644 --- a/.github/workflows/build-conquest-python.yml +++ b/.github/workflows/build-conquest-python.yml @@ -95,6 +95,13 @@ jobs: echo "archive_filename=$archive_filename" >> $GITHUB_ENV echo "archive_path=$archive_path" >> $GITHUB_ENV + - name: Store conquest python as build artifact + if: ${{ !inputs.artifactory-push }} + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + path: "${{ env.archive_path }}/${{ env.archive_filename }}" + - name: Set up JFrog CLI if: ${{ inputs.artifactory-push }} uses: jfrog/setup-jfrog-cli@v4 From e4cabde7a2f5eab3531ec9b518b59fad18ad655b Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Mon, 2 Jun 2025 18:34:31 +0100 Subject: [PATCH 7/7] Give artifact a sensible name (CQ-1519) --- .github/workflows/build-conquest-python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index 901c2e1..7e58ec9 100644 --- a/.github/workflows/build-conquest-python.yml +++ b/.github/workflows/build-conquest-python.yml @@ -101,6 +101,7 @@ jobs: with: retention-days: 1 path: "${{ env.archive_path }}/${{ env.archive_filename }}" + name: ${{ env.archive_filename }} - name: Set up JFrog CLI if: ${{ inputs.artifactory-push }}