diff --git a/.github/workflows/build-conquest-python.yml b/.github/workflows/build-conquest-python.yml index 6d2cc42..7e58ec9 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,13 +45,13 @@ 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 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 @@ -81,6 +77,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) @@ -89,6 +95,14 @@ 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: ${{ env.archive_filename }} + - name: Set up JFrog CLI if: ${{ inputs.artifactory-push }} uses: jfrog/setup-jfrog-cli@v4 diff --git a/build_conquest_python.py b/build_conquest_python.py index a58fd3a..8b8ec27 100755 --- a/build_conquest_python.py +++ b/build_conquest_python.py @@ -758,6 +758,14 @@ 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", "-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: 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