Skip to content

Commit 7bfa57c

Browse files
committed
Look up Python ABI version, instead of hardcoding
- Hardcoded 'python3.7', 'exe.mingw-3.7', etc. strings have been replaced with one constructed using the value of the sysconfig.py config variable 'py_version_short' - Only exceptions: macOS-only code in fix_qt5_rpath.py/build_mac_dmg.sh (XXX comments placed, warning of their lack of future-proofing)
1 parent fbd3551 commit 7bfa57c

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ windows-builder-x86:
136136
- $PREV_GIT_LABEL=(git describe --tags --abbrev=0 '@^')
137137
- git log "$PREV_GIT_LABEL..@" --oneline --pretty=format:"- %C(auto,yellow)%h%C(auto,magenta)% %C(auto,blue)%>(12,trunc)%ad %C(auto,green)%<(25,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" --date=short > "build/install-x86/share/$CI_PROJECT_NAME.log"
138138
- python3 -u freeze.py build --git-branch=$CI_COMMIT_REF_NAME
139-
- editbin /LARGEADDRESSAWARE "$CI_PROJECT_DIR\build\exe.mingw-3.7\openshot-qt.exe"
139+
- editbin /LARGEADDRESSAWARE "$CI_PROJECT_DIR\build\exe.mingw-$PyABI\openshot-qt.exe"
140140
- python3 -u installer/build_server.py "$SLACK_TOKEN" "$WINDOWS_KEY" "$WINDOWS_PASSWORD" "$GITHUB_USER" "$GITHUB_PASS" "True" "$CI_COMMIT_REF_NAME"
141141
when: always
142142
except:

installer/build-mac-dmg.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
3+
# XXX: These paths should be set using `brew prefix` commands,
4+
# for future-proofing against upgrades
25
PATH=/usr/local/Cellar/[email protected]/3.7.9_2/Frameworks/Python.framework/Versions/3.7/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/qt5/5.5/clang_64/bin:/opt/X11/bin
36

47
# Get Version

installer/build_server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
import re
3535
import stat
3636
import subprocess
37+
import sysconfig
3738
import traceback
3839
from github3 import login
3940
from requests.auth import HTTPBasicAuth
4041
from requests import post
4142
from version_parser import parse_version_info, parse_build_name
4243

4344
PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) # Primary openshot folder
45+
PY_ABI = sysconfig.get_config_var('py_version_short')
4446

4547
# Access info class (for version info)
4648
sys.path.append(os.path.join(PATH, 'src', 'classes'))
@@ -410,8 +412,8 @@ def main():
410412

411413
if platform.system() == "Windows":
412414
# Move python folder structure, since Cx_Freeze doesn't put it in the correct place
413-
exe_dir = os.path.join(PATH, 'build', 'exe.mingw-3.7')
414-
python_dir = os.path.join(exe_dir, 'lib', 'python3.7')
415+
exe_dir = os.path.join(PATH, 'build', 'exe.mingw-{}'.format(PY_ABI))
416+
python_dir = os.path.join(exe_dir, 'lib', 'python{}'.format(PY_ABI))
415417

416418
# Remove a redundant openshot_qt module folder (duplicates lots of files)
417419
duplicate_openshot_qt_path = os.path.join(python_dir, 'openshot_qt')
@@ -521,6 +523,7 @@ def main():
521523
'/Q',
522524
'/DVERSION=%s' % version,
523525
'/DONLY_64_BIT=%s' % only_64_bit,
526+
'/DPY_EXE_DIR=%s' % "exe.mingw-{}".format(PY_ABI),
524527
'"%s"' % os.path.join(PATH, 'installer', 'windows-installer.iss'),
525528
])
526529
inno_output = ""

installer/fix_qt5_rpath.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def print_min_versions(PATH):
112112

113113

114114
if __name__ == "__main__":
115-
"""Run these methods manually for testing"""
115+
# Run these methods manually for testing
116+
117+
# XXX: This path should be set programmatically, somehow
116118
PATH = "/Users/jonathanthomas/apps/openshot-qt/build/exe.macosx-10.15-x86_64-3.7"
117119
fix_rpath(PATH)
118120
print_min_versions(PATH)

installer/windows-installer.iss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#ifndef ONLY_64_BIT
88
#define ONLY_64_BIT "x64"
99
#endif
10+
#ifndef PY_EXE_DIR
11+
#define PY_EXE_DIR "exe.mingw-3.8"
12+
#endif
1013

1114

1215
#define MyAppName "OpenShot Video Editor"
@@ -138,7 +141,7 @@ Root: HKLM; Subkey: "Software\Classes\OpenShotProject\shell\open\command"; Value
138141

139142
[Files]
140143
; Add all frozen files from cx_Freeze build
141-
Source: "..\build\exe.mingw-3.7\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
144+
Source: "..\build\{#PY_EXE_DIR}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
142145

143146
[Icons]
144147
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

0 commit comments

Comments
 (0)