Skip to content

Commit de99c80

Browse files
authored
Merge pull request #11 from GPLgithub/master
Python 3.11 and PySide6
2 parents 8228d8a + 3c4bfe1 commit de99c80

File tree

6 files changed

+40
-37
lines changed

6 files changed

+40
-37
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ This is a helper library designed to be used in
44
conjunction with the [tk-unreal](https://github.com/ue4plugins/tk-unreal) engine.
55

66
This framework contains hooks which can be re-used in configurations where the
7-
Unreal integration is needed, and PySide2 binaries needed to run the SG Toolkit
7+
Unreal integration is needed, and PySide binaries needed to run the SG Toolkit
88
integration in Unreal.
99

1010
Please see the engine for more details.
1111

12-
## The PySide2 libraries
12+
## The PySide libraries
1313

14-
Binaries for PySide2 libraries for all platforms are not included in the
14+
Binaries for PySide libraries for all platforms are not included in the
1515
source tree and must be built before being able to use this framework.
1616

17-
### Building the PySide2 libraries locally
17+
### Building the PySide libraries locally
1818

1919
Use the [build_packages.sh](resources/build_packages.sh) script with the `-b` option to build and install
2020
the packages specified in the [requirements.txt](resources/requirements.txt) file.
@@ -28,7 +28,7 @@ Options :
2828
The framework can be used with a local descriptor (e.g. dev or path) once the
2929
binaries are build.
3030

31-
### Building the PySide2 libraries with Azure Pipelines
31+
### Building the PySide libraries with Azure Pipelines
3232

3333
The [build_packages.sh](resources/build_packages.sh) script can be used with [Azure Pipelines](https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started/pipelines-get-started?view=azure-devops)
3434
to automatically build the packages each time a new version tag is added in Github.
@@ -41,7 +41,7 @@ You can use the provided [azure-pipelines.yml](azure-pipelines.yml) file to crea
4141
A [service connection to Github](https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#permissions-needed-in-github-1)
4242
will have to be created if you don't already have one.
4343

44-
The Azure pipeline builds the PySide2 libraries for Windows, Linux and Mac, and upload them to Github releases.
44+
The Azure pipeline builds the PySide libraries for Windows, Linux and Mac, and upload them to Github releases.
4545

4646
<img width="512" alt="Github releases" src="https://user-images.githubusercontent.com/39291844/153920988-0dcb80d3-3c37-479d-8079-33496f8952f4.png">
4747

@@ -56,8 +56,8 @@ frameworks:
5656
- {"name": "tk-framework-unrealqt", "version": "v1.x.x"}
5757
```
5858

59-
- If you're using a local descriptor (dev or path) you need to build the PySide2 libraries
60-
yourself. See [building the PySide2 libraries locally](#building-the-pyside2-libraries-locally).
59+
- If you're using a local descriptor (dev or path) you need to build the PySide libraries
60+
yourself. See [building the PySide libraries locally](#building-the-pyside2-libraries-locally).
6161

6262
- If you're using a remote descriptor, just in time download must be added so these binaries are downloaded in SG TK bootstrap process. The provided [bootstrap.py](hooks/core/bootstrap.py) script implements just in time downloads from Github releases with a `git` or a `github_release` descriptor:
6363
- Copy the `hooks/core/bootstrap.py` file to your config `core/hooks/bootstrap.py`

azure-pipelines.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ jobs:
2424
strategy:
2525
matrix:
2626
# Define all the platform/python version we need
27-
MacPython37:
27+
MacPython311:
2828
platform: 'osx' # Short name for us
29-
imageName: 'macOS-10.15'
30-
python.version: '3.7'
31-
WinPython37:
29+
imageName: 'macOS-latest'
30+
python.version: '3.11'
31+
WinPython311:
3232
platform: 'win' # Short name for us
33-
imageName: 'windows-2019'
34-
python.version: '3.7'
35-
LinuxPython37:
33+
imageName: 'windows-latest'
34+
python.version: '3.11'
35+
LinuxPython311:
3636
platform: 'linux' # Short name for us
3737
imageName: 'ubuntu-latest'
38-
python.version: '3.7'
38+
python.version: '3.11'
3939
maxParallel: 1
4040

4141
pool:
@@ -84,12 +84,9 @@ jobs:
8484
inputs:
8585
Contents: |
8686
.git
87-
resources/packagevenv_osx_2
88-
resources/packagevenv_osx_3
89-
resources/packagevenv_windows_2
90-
resources/packagevenv_windows_3
91-
resources/packagevenv_linux_2
92-
resources/packagevenv_linux_3
87+
resources/packagevenv_osx_3.11
88+
resources/packagevenv_windows_3.11
89+
resources/packagevenv_linux_3.11
9390
9491
# Archive files
9592
# Compress files into .7z, .tar.gz, or .zip

framework.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# file included in this repository.
44

55
"""
6-
Framework containing PySide2 distributions for the Unreal engine
6+
Framework containing PySide distributions for the Unreal engine
77
8-
Because Unreal does not include PySide2/Qt distributions but does use its own
8+
Because Unreal does not include PySide/Qt distributions but does use its own
99
version of Python, we have to distribute full versions for the engine to function.
1010
"""
1111

@@ -31,15 +31,15 @@ def init_framework(self):
3131
Something similar to what `virtualenv` does is done when this framework is
3232
loaded by SG TK.
3333
"""
34-
self.log_debug("%s: Initializing UnrealQtFramework..." % self)
34+
self.logger.debug("%s: Initializing UnrealQtFramework..." % self)
3535

3636
# Check if PySide is already available, do nothing if it is the case
3737
try:
3838
from sgtk.platform.qt import QtCore # noqa
39-
self.log_debug("Qt is already available, not activating any custom package.")
39+
self.logger.debug("Qt is already available, not activating any custom package.")
4040
return
4141
except ImportError as e:
42-
self.log_debug("Qt is not available: %s, activating custom package." % e)
42+
self.logger.debug("Qt is not available: %s, activating custom package." % e)
4343
pass
4444
# Remap the platform name to our names
4545
pname = self.platform_name()
@@ -53,13 +53,14 @@ def init_framework(self):
5353
# Copied over from activate_this.py script which does not exist anymore
5454
# from Python 3.
5555
python_major = sys.version_info[0] # 2 or 3
56+
python_minor = sys.version_info[1] # 6, 7, 8, etc
5657

5758
base_path = os.path.realpath(
5859
os.path.join(
5960
os.path.dirname(__file__),
6061
"python",
6162
"vendors",
62-
"py%d" % python_major,
63+
"py%d.%d" % (python_major, python_minor),
6364
pname,
6465
)
6566
)
@@ -74,7 +75,7 @@ def init_framework(self):
7475
"lib"
7576
)
7677
)
77-
python_pattern = r"^python%d\.\d$" % python_major
78+
python_pattern = r"^python%d\.\d+$" % python_major
7879
for folder in lib_folders:
7980
if re.match(python_pattern, folder):
8081
break
@@ -108,7 +109,7 @@ def init_framework(self):
108109
sys.prefix = base_path
109110

110111
def destroy_framework(self):
111-
self.log_debug("%s: Destroying UnrealQtFramework..." % self)
112+
self.logger.debug("%s: Destroying UnrealQtFramework..." % self)
112113

113114
@classmethod
114115
def platform_name(cls):

hooks/core/bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def populate_bundle_cache_entry(self, destination, descriptor, **kwargs):
138138
for asset in response_d["assets"]:
139139
name = asset["name"]
140140
m = re.match(
141-
r"%s-py\d.\d-%s.zip" % (version, pname),
141+
r"%s-py\d.\d+-%s.zip" % (version, pname),
142142
name
143143
)
144144
if m:

resources/build_packages.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,20 @@ echo "Detecting Python version..."
133133
python_version=$($python_cmd --version 2>&1)
134134
# 2 or 3
135135
python_major_version=${python_version:7:1}
136-
if [ -z $python_major_version ];
136+
# Remove patch number from Python 3.9.17
137+
no_patch=${python_version%\.*}
138+
# 3.9
139+
python_major_minor=${no_patch:7}
140+
141+
if [ -z $python_major_version ] || [ -z $python_major_minor ];
137142
then
138143
echo "Unable to detect python version, aborting"
139144
exit 1
140145
fi
141146

142-
echo "Detected python version ${python_major_version} from ${python_version}"
147+
echo "Detected python version ${python_major_version} from ${python_version} (${python_major_minor})"
143148

144-
packagevenv="packagevenv_${platform_name}_${python_major_version}"
149+
packagevenv="packagevenv_${platform_name}_${python_major_minor}"
145150
if [ ! -d $packagevenv ]; then
146151
if [ ${python_major_version} == 2 ];
147152
then
@@ -200,8 +205,8 @@ if [ $do_build == 1 ]; then
200205
fi
201206
# Copy packages to their shipping destination
202207
if [ -d ./${packagevenv} ]; then
203-
mkdir -p ../python/vendors/py${python_major_version}
204-
target="../python/vendors/py${python_major_version}/${platform_name}"
208+
mkdir -p ../python/vendors/py${python_major_minor}
209+
target="../python/vendors/py${python_major_minor}/${platform_name}"
205210
if [ -d $target ]; then
206211
echo "Deleting previous build in $target"
207212
# Clean up git but don't fail if there is nothing matching

resources/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## The following requirements were added by pip --freeze:
22

3-
PySide2==5.15.2
3+
PySide6==6.7.0

0 commit comments

Comments
 (0)