Skip to content

Commit 14d22c9

Browse files
committed
fixes
1 parent 405b336 commit 14d22c9

File tree

2 files changed

+21
-213
lines changed

2 files changed

+21
-213
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -11,209 +11,6 @@ defaults:
1111
shell: bash
1212

1313
jobs:
14-
ubuntu:
15-
strategy:
16-
fail-fast: false
17-
matrix:
18-
container:
19-
- 'ubuntu:20.04'
20-
- 'ubuntu:22.04'
21-
runs-on: ubuntu-latest
22-
container: ${{ matrix.container }}
23-
steps:
24-
- name: Install Qt
25-
run: |
26-
apt-get update
27-
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
28-
build-essential \
29-
python3 \
30-
python3-dev \
31-
libpython3-dev \
32-
qtbase5-dev \
33-
qtbase5-private-dev \
34-
qt5-qmake \
35-
qtbase5-dev-tools \
36-
qttools5-dev \
37-
qtdeclarative5-dev \
38-
libqt5svg5* \
39-
libqt5xmlpatterns5* \
40-
libqt5multimedia5* \
41-
libqt5multimediawidgets5* \
42-
libqt5qml5* \
43-
libqt5quickwidgets5* \
44-
qtmultimedia5-dev
45-
apt-get clean
46-
47-
- name: Checkout PythonQt
48-
uses: actions/checkout@v3
49-
50-
- name: Build PythonQt
51-
run: |
52-
export QT_SELECT=qt5
53-
echo ======= SYSTEM INFO ========
54-
uname -a; gcc --version | grep "gcc"; python3 --version; qmake --version
55-
echo ============================
56-
qmake -r PythonQt.pro CONFIG+=release CONFIG+=sanitizer CONFIG+=sanitize_undefined \
57-
PYTHON_VERSION=$(python3 --version | cut -d " " -f 2 | cut -d "." -f1,2) \
58-
PYTHON_PATH=$(which python3 | xargs dirname)
59-
make -j 2 && make check TESTARGS="-platform offscreen"
60-
61-
- name: Generate Wrappers
62-
run: |
63-
# workaround to allow to find the Qt include dirs for installed standard qt packages
64-
mkdir /usr/include/qt5; ln -s /usr/include/x86_64-linux-gnu/qt5 /usr/include/qt5/include
65-
export QTDIR=/usr/include/qt5
66-
cd generator
67-
./pythonqt_generator
68-
69-
- name: Upload Wrappers
70-
uses: actions/upload-artifact@v3
71-
if: ${{ matrix.container }} == 'ubuntu:20.04'
72-
with:
73-
name: wrappers_ubuntu_20_04
74-
path: generated_cpp
75-
76-
- name: Upload Wrappers
77-
uses: actions/upload-artifact@v3
78-
if: ${{ matrix.container }} == 'ubuntu:22.04'
79-
with:
80-
name: wrappers_ubuntu_22_04
81-
path: generated_cpp
82-
83-
centos:
84-
strategy:
85-
fail-fast: false
86-
matrix:
87-
container:
88-
- 'centos:7'
89-
runs-on: ubuntu-latest
90-
container: ${{ matrix.container }}
91-
steps:
92-
- name: Install Qt
93-
run: |
94-
yum update -y
95-
yum groupinstall "Development Tools" -y
96-
yum install -y \
97-
which \
98-
python-debug \
99-
qt5-qtbase-* \
100-
qt5-qttools* \
101-
qt5-qtsvg \
102-
qt5-qtxmlpatterns \
103-
qt5-qtmultimedia \
104-
qt5-qt3d \
105-
qt5-*-devel
106-
107-
- name: Checkout PythonQt
108-
uses: actions/checkout@v3
109-
110-
- name: Build PythonQt
111-
run: |
112-
export QT_SELECT=qt5
113-
echo ======= SYSTEM INFO ========
114-
uname -a; gcc --version | grep "gcc"; python --version; qmake-qt5 --version
115-
echo ============================
116-
qmake-qt5 -r PythonQt.pro CONFIG+=release \
117-
PYTHON_VERSION=$(python --version | cut -d " " -f 2 | cut -d "." -f1,2) \
118-
PYTHON_PATH=$(which python | xargs dirname)
119-
make -j 2 && make check TESTARGS="-platform offscreen"
120-
121-
- name: Generate Wrappers
122-
run: |
123-
# workaround to allow to find the Qt include dirs for installed standard qt packages
124-
mkdir /usr/include/qt5ln; ln -s /usr/include/qt5 /usr/include/qt5ln/include
125-
export QTDIR=/usr/include/qt5ln
126-
cd generator
127-
./pythonqt_generator
128-
129-
- name: Upload Wrappers
130-
uses: actions/upload-artifact@v3
131-
with:
132-
name: wrappers_centos7
133-
path: generated_cpp
134-
135-
macOS:
136-
strategy:
137-
fail-fast: false
138-
matrix:
139-
macos-version: ['10.15']
140-
python-version: ['2.7']
141-
qt-version: ['5.9.*']
142-
include:
143-
- macos-version: '11'
144-
python-version: '3.6'
145-
qt-version: '5.11.*'
146-
- macos-version: '12'
147-
python-version: '3.11'
148-
qt-version: '5.12.*'
149-
runs-on: macos-${{ matrix.macos-version }}
150-
steps:
151-
- name: Install Qt
152-
uses: jurplel/install-qt-action@v3
153-
with:
154-
aqtversion: '==2.1.*'
155-
version: ${{ matrix.qt-version }}
156-
host: 'mac'
157-
target: 'desktop'
158-
arch: 'clang_64'
159-
modules: 'qtscript'
160-
archives: 'qtmultimedia qtmacextras qtbase qttools'
161-
162-
- name: Setup Python ${{ matrix.python-version }}
163-
uses: actions/setup-python@v4
164-
with:
165-
python-version: '${{ matrix.python-version }}'
166-
167-
- name: Checkout PythonQt
168-
uses: actions/checkout@v3
169-
170-
- name: Detect exact versions
171-
id : versions
172-
run : |
173-
set -eu
174-
PYTHON_VERSION_FULL=$(python --version 2>&1 | cut -f 2 -d ' ')
175-
PYTHON_VERSION_SHORT=$(cut -f 1,2 -d . <<< $PYTHON_VERSION_FULL)
176-
QT_VERSION_FULL=$($Qt5_Dir/bin/qmake -query QT_VERSION)
177-
QT_VERSION_SHORT=$(cut -f 1,2 -d . <<< $QT_VERSION_FULL)
178-
MACOS_VERSION_FULL=$(sw_vers -productVersion)
179-
MACOS_VERSION_SHORT=$(cut -f 1,2 -d . <<< $MACOS_VERSION_FULL)
180-
181-
echo "PYTHON_VERSION_FULL=$PYTHON_VERSION_FULL" | tee -a $GITHUB_OUTPUT
182-
echo "PYTHON_VERSION_SHORT=$PYTHON_VERSION_SHORT" | tee -a $GITHUB_OUTPUT
183-
echo "QT_VERSION_FULL=$QT_VERSION_FULL" | tee -a $GITHUB_OUTPUT
184-
echo "QT_VERSION_SHORT=$QT_VERSION_SHORT" | tee -a $GITHUB_OUTPUT
185-
echo "MACOS_VERSION_FULL=$MACOS_VERSION_FULL" | tee -a $GITHUB_OUTPUT
186-
echo "MACOS_VERSION_SHORT=$MACOS_VERSION_SHORT" | tee -a $GITHUB_OUTPUT
187-
188-
- name: Build PythonQt
189-
run: |
190-
set -ue
191-
echo ======= SYSTEM INFO ========
192-
uname -a; gcc --version | head -n 1; python --version; qmake --version
193-
echo ============================
194-
PYTHON_VERSION_MAJOR=$(cut -d . -f1 <<< ${{ steps.versions.outputs.PYTHON_VERSION_SHORT }})
195-
for i in "python${{ steps.versions.outputs.PYTHON_VERSION_SHORT }}-embed" "python${{ steps.versions.outputs.PYTHON_VERSION_SHORT }}" \
196-
"python${PYTHON_VERSION_MAJOR}-embed" "python${PYTHON_VERSION_MAJOR}"
197-
do if pkg-config --exists "$i"; then PYTHON_PKGCONFIG_NAME="$i"; break; fi; done
198-
qmake CONFIG+=release CONFIG+=sanitizer CONFIG+=sanitize_undefined \
199-
PYTHON_VERSION=${{ steps.versions.outputs.PYTHON_VERSION_SHORT }} \
200-
PYTHON_PATH="$pythonLocation/bin" \
201-
PKGCONFIG+=$PYTHON_PKGCONFIG_NAME \
202-
-r PythonQt.pro
203-
make -j 2 && make check TESTARGS="-platform offscreen"
204-
205-
- name: Generate Wrappers
206-
run: |
207-
cd generator
208-
# workaround to allow to find the Qt include dirs for installed standard qt packages
209-
QTDIR=-UNDEFINED- ./pythonqt_generator --include-paths=$Qt5_Dir/lib
210-
211-
- name: Upload Wrappers
212-
uses: actions/upload-artifact@v3
213-
with:
214-
name: wrappers_macos${{ steps.versions.outputs.MACOS_VERSION_SHORT }}_qt${{ steps.versions.outputs.QT_VERSION_SHORT }}
215-
path: generated_cpp
216-
21714
windows:
21815
strategy:
21916
fail-fast: false
@@ -266,8 +63,8 @@ jobs:
26663
target: 'desktop'
26764
arch: ${{ matrix.qt-arch }}
26865
modules: 'qtscript'
269-
archives: 'qtmultimedia qtbase qttools'
270-
tools: ${{ contains(matrix.qt-arch, 'mingw') && format('qt.tools.{0}0', matrix.qt-arch) || '' }}
66+
archives: 'qtwinextras qtmultimedia qtbase qttools'
67+
tools: ${{ contains(matrix.qt-arch, 'mingw') && format('tools_mingw,qt.tools.{0}0', matrix.qt-arch) || '' }}
27168

27269
- name: Setup Python ${{ matrix.python-version }}
27370
uses: actions/setup-python@v4
@@ -285,13 +82,14 @@ jobs:
28582
QT_VERSION_SHORT=$(cut -f 1,2 -d . <<< $QT_VERSION_FULL)
28683
echo "QT_VERSION_FULL=$QT_VERSION_FULL" | tee -a $GITHUB_OUTPUT
28784
echo "QT_VERSION_SHORT=$QT_VERSION_SHORT" | tee -a $GITHUB_OUTPUT
85+
echo "CL=/MP" | tee -a $GITHUB_ENV #multicore parallel build for cl.exe
28886
28987
- name: Build PythonQt
29088
shell: cmd
29189
run: |
292-
set PATH
293-
qmake -Wall -d CONFIG+=release "PYTHON_PATH=%pythonLocation%" -after "QMAKE_SH=" PythonQt.pro
294-
make -j 2 && make check "TESTARGS=-platform offscreen" || nmake && nmake check "TESTARGS=-platform offscreen"
90+
${{ contains(matrix.qt-arch, 'mingw') && format('FOR /F "tokens=1,2 delims=_" %%I IN ("{0}") DO SET "PATH=%PATH%;%IQTA_TOOLS%\%%J0_{1}\bin', matrix.qt-arch, contains(matrix.qt-arch, 'win32') && '32' || '64') || '' }}
91+
qmake -Wall -d CONFIG+=release "PYTHON_PATH=%pythonLocation%" -after "QMAKE_SH=" "QMAKE_LINK_OBJECT_MAX=100" PythonQt.pro
92+
mingw32-make -j 2 && mingw32-make check "TESTARGS=-platform offscreen" || nmake && nmake check "TESTARGS=-platform offscreen"
29593
29694
- name: Generate Wrappers
29795
shell: cmd

build/python.prf

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ isEmpty( PYTHON_VERSION ) {
66
PYTHON_VERSION=$$(PYTHON_VERSION)
77
}
88

9+
isEmpty(PYTHON_DIR):PYTHON_DIR=$$(PYTHON_DIR)
10+
!isEmpty(PYTHON_DIR):error(Use PYTHON_PATH to choose exact Python installation instead of PYTHON_DIR)
11+
912
isEmpty( PYTHON_PATH ) {
1013
PYTHON_PATH=$$(PYTHON_PATH)
1114
}
@@ -19,19 +22,26 @@ isEmpty(PYTHON_CMD):PYTHON_CMD=python
1922
!isEmpty(PYTHON_PATH):PYTHON_CMD=$${PYTHON_PATH}$${QMAKE_DIR_SEP}$${PYTHON_CMD}
2023
contains(QMAKE_HOST.os, Windows):PYTHON_CMD=$${PYTHON_CMD}.exe
2124
PYTHON_CMD=$$system_path($$PYTHON_CMD)
25+
!isEmpty(PYTHON_PATH):!exists($$PYTHON_CMD):error("Incorrect PYTHON_PATH was set, missing $$PYTHON_CMD")
26+
27+
isEmpty(PYTHON_PATH): PYTHON_PATH=$$system($$system_quote($${PYTHON_CMD}) -c \
28+
$$system_quote(import os;import sys;print(os.path.dirname(sys.executable))))$${QMAKE_DIR_SEP}
29+
30+
#Not just "python --version" because Python 2 outputs `--version` to the stderr
31+
#And there is no simple way known for me to generally redirect stderr to stdout
32+
PYTHON_VERSION_DETECTED=$$system($$system_quote($${PYTHON_CMD}) -c $$system_quote(import sysconfig;print(sysconfig.get_python_version())))
2233

2334

2435
isEmpty( PYTHON_VERSION ) {
2536
warning(PYTHON_VERSION should be set explicitly from qmake command-line or via environment.\
2637
$$escape_expand(\\n\\t) F.e.: $$shell_quote(qmake PYTHON_VERSION=3.6 CONFIG+=release) \
2738
or $$shell_quote(set PYTHON_VERSION=2.7))
2839
message(Trying $${PYTHON_CMD} executable to guess the version)
29-
isEmpty(PYTHON_PATH): PYTHON_PATH=$$system($$system_quote($${PYTHON_CMD}) -c \
30-
$$system_quote(import os;import sys;print(os.path.dirname(sys.executable))))$${QMAKE_DIR_SEP}
40+
PYTHON_VERSION=$$PYTHON_VERSION_DETECTED
41+
}
3142

32-
#Not just "python --version" because Python 2 outputs `--version` to the stderr
33-
#And there is no simple way known for me to generally redirect stderr to stdout
34-
PYTHON_VERSION=$$system($$system_quote($${PYTHON_CMD}) -c $$system_quote(import sysconfig;print(sysconfig.get_python_version())))
43+
!equals(PYTHON_VERSION, $$PYTHON_VERSION_DETECTED){
44+
error("Found Python version $$PYTHON_VERSION_DETECTED, but $$PYTHON_VERSION was requested")
3545
}
3646

3747
PYTHON_VERSION_MAJOR=$$section(PYTHON_VERSION, ., 0, 0)

0 commit comments

Comments
 (0)