Skip to content

Commit cd673e8

Browse files
Merge pull request #22 from ccdc-opensource/fix-pyinstaller
Add patch for Pyinstaller bug (CQ-1519)
2 parents c5ba687 + e4cabde commit cd673e8

File tree

3 files changed

+45
-10
lines changed

3 files changed

+45
-10
lines changed

.github/workflows/build-conquest-python.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ jobs:
3636
- name: Set output
3737
id: set_output
3838
run: |
39-
if [[ "${{ inputs.platforms }}" == "rocky8" ]]; then
40-
echo runson=ubuntu-latest >> $GITHUB_OUTPUT
41-
echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT
42-
echo python=python3 >> $GITHUB_OUTPUT
43-
elif [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then
39+
if [[ "${{ inputs.platforms }}" == "ubuntu" ]]; then
4440
echo runson=ubuntu-latest >> $GITHUB_OUTPUT
4541
echo python=python3 >> $GITHUB_OUTPUT
4642
elif [[ "${{ inputs.platforms }}" == "macos" ]]; then
@@ -49,13 +45,13 @@ jobs:
4945
elif [[ "${{ inputs.platforms }}" == "windows" ]]; then
5046
echo runson=windows-2019 >> $GITHUB_OUTPUT
5147
echo python=python >> $GITHUB_OUTPUT
48+
else
49+
# default to Rocky
50+
echo runson=ubuntu-latest >> $GITHUB_OUTPUT
51+
echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT
52+
echo python=python3 >> $GITHUB_OUTPUT
5253
fi
5354
54-
# Build the conquest python for rocky8
55-
echo runson=ubuntu-latest >> $GITHUB_OUTPUT
56-
echo container=ccdcrepository.azurecr.io/conan/rocky8-gcc10:latest >> $GITHUB_OUTPUT
57-
echo python=python3 >> $GITHUB_OUTPUT
58-
5955
build-upload:
6056
needs:
6157
- setup
@@ -81,6 +77,16 @@ jobs:
8177
${{ needs.setup.outputs.python }} --version
8278
${{ needs.setup.outputs.python }} -m pip install --upgrade pip wheel setuptools
8379
80+
- name: Install patch
81+
run: |
82+
if [[ "${{ needs.setup.outputs.runson }}" == "ubuntu-latest" ]]; then
83+
if [[ -f /etc/rocky-release ]]; then
84+
sudo dnf install -y patch
85+
else
86+
sudo apt update && sudo apt install -y patch
87+
fi
88+
fi
89+
8490
- name: Build conquest python
8591
run: |
8692
output=$(${{ needs.setup.outputs.python }} build_conquest_python.py | grep Creating | tail -n 1)
@@ -89,6 +95,14 @@ jobs:
8995
echo "archive_filename=$archive_filename" >> $GITHUB_ENV
9096
echo "archive_path=$archive_path" >> $GITHUB_ENV
9197
98+
- name: Store conquest python as build artifact
99+
if: ${{ !inputs.artifactory-push }}
100+
uses: actions/upload-artifact@v4
101+
with:
102+
retention-days: 1
103+
path: "${{ env.archive_path }}/${{ env.archive_filename }}"
104+
name: ${{ env.archive_filename }}
105+
92106
- name: Set up JFrog CLI
93107
if: ${{ inputs.artifactory-push }}
94108
uses: jfrog/setup-jfrog-cli@v4

build_conquest_python.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,14 @@ def main():
758758
"fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'"),
759759
)
760760

761+
# Patch Pyinstaller to fix https://github.com/pyinstaller/pyinstaller/issues/5540
762+
# The actual fix for this isn't in any of the 3.x versions, and 4.x onwards require Python 3 :(
763+
if Package().linux:
764+
command = ["patch", "-p1", "-i", os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyinstaller.patch")]
765+
print(f"Applying patch with {' '.join(command)}")
766+
package_path = ConquestPythonPackage().python_base_directory / "lib" / "python2.7" / "site-packages"
767+
subprocess.run(command, cwd=package_path)
768+
761769
if not Package().windows:
762770
bdb_env = dict(os.environ)
763771
bdb_env['BERKELEYDB_DIR'] = f'{ConquestPythonPackage().python_base_directory}'

pyinstaller.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/PyInstaller/depend/utils.py b/PyInstaller/depend/utils.py
2+
index 4776676b7..eca1e9dd8 100644
3+
--- a/PyInstaller/depend/utils.py
4+
+++ b/PyInstaller/depend/utils.py
5+
@@ -372,6 +372,8 @@ def load_ldconfig_cache():
6+
for line in text:
7+
# :fixme: this assumes libary names do not contain whitespace
8+
m = pattern.match(line)
9+
+ if m is None:
10+
+ continue
11+
path = m.groups()[-1]
12+
if is_freebsd:
13+
# Insert `.so` at the end of the lib's basename. soname

0 commit comments

Comments
 (0)