Skip to content

Commit dd4c4cc

Browse files
PySide6 Port #628 + Cleanup [CPP-794] (#667)
Co-authored-by: Keith Kyzivat <[email protected]> Co-authored-by: [email protected] <jm>
1 parent 1c48f20 commit dd4c4cc

File tree

127 files changed

+1106
-1522
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1106
-1522
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
"console_backend/tests/data/*" filter=lfs diff=lfs merge=lfs -text
2-
"pyside-wheels/*.whl" filter=lfs diff=lfs merge=lfs -text
32
installers/Windows/NSIS/*.zip filter=lfs diff=lfs merge=lfs -text

.github/workflows/main.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
strategy:
3030
matrix:
3131
os:
32-
- ubuntu-18.04
33-
- macos-10.15
32+
- ubuntu-20.04
33+
- macos-11
3434
- windows-2019
3535

3636
runs-on: ${{ matrix.os }}
@@ -92,6 +92,7 @@ jobs:
9292
path: ${{ env.PIP_CACHE_DIR }}
9393
key: ${{ runner.os }}-pyproject-toml-${{ secrets.CACHE_VERSION }}-${{ hashFiles('pyproject.toml') }}
9494

95+
9596
- name: Install ImageMagick
9697
shell: bash
9798
run: |
@@ -120,10 +121,9 @@ jobs:
120121

121122
name: Code Quality Checks
122123

123-
runs-on: ubuntu-18.04
124+
runs-on: ubuntu-20.04
124125

125126
steps:
126-
127127
- name: Checkout source
128128
uses: actions/checkout@v2
129129
with:
@@ -176,10 +176,22 @@ jobs:
176176
env:
177177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178178

179+
- name: Install Qt
180+
uses: jurplel/install-qt-action@910f37ee23653fd4b243fe5c7f81ff26a8a6a64e
181+
with:
182+
version: '6.3.1'
183+
setup-python: false
184+
179185
- name: Run Checks
180186
run: |
181187
cargo make check-all
182188
189+
# TODO Fix qmllint warnings [CPP-798]
190+
- name: Run qmllint
191+
continue-on-error: true
192+
run: |
193+
cargo make qml-lint
194+
183195
- name: Run Tests
184196
uses: nick-invision/retry@v2
185197
with:
@@ -199,8 +211,8 @@ jobs:
199211
strategy:
200212
matrix:
201213
os:
202-
- {name: ubuntu-18.04, exe_suffix: "", short_name: "linux"}
203-
- {name: macos-10.15, exe_suffix: "", short_name: "macos"}
214+
- {name: ubuntu-20.04, exe_suffix: "", short_name: "linux"}
215+
- {name: macos-11, exe_suffix: "", short_name: "macos"}
204216
- {name: windows-2019, exe_suffix: ".exe", short_name: "windows"}
205217

206218
runs-on: ${{ matrix.os.name }}
@@ -406,6 +418,7 @@ jobs:
406418
env:
407419
OS_NAME: ${{ runner.os }}
408420
shell: bash
421+
continue-on-error: true
409422
run: |
410423
cargo make disk-usage-bench
411424
@@ -472,7 +485,7 @@ jobs:
472485
"$f"
473486
done
474487
475-
for f in $(ls Contents/Resources/lib/python3.9/site-packages/**/Qt/lib/*.framework/Versions/5/*)
488+
for f in $(ls -d Contents/Resources/lib/python3.9/site-packages/**/Qt/lib/*.framework/Versions/A/*)
476489
do
477490
codesign -vvvv \
478491
-s "${{ secrets.APPLE_DEVELOPER_ID }}" \

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ installers/Windows/*.exe
2121
installers/Linux/*.deb
2222
installers/Windows/NSIS/*
2323
!installers/Windows/NSIS/*.zip
24+
/.qt_for_python

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Module",
9+
"type": "python",
10+
"request": "launch",
11+
"module": "swiftnav_console.main",
12+
"stopOnEntry": false,
13+
"sourceLanguages": [
14+
"rust",
15+
"python",
16+
"c++"
17+
],
18+
"preLaunchTask": "prepare-run"
19+
}
20+
]
21+
}

Makefile.toml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if eq ${os} windows
88
set_env STANDALONE_PY_URL "${PY_BASE_URL}/cpython-3.9.7-x86_64-pc-windows-msvc-shared-pgo-20211017T1616.tar.zst"
99
set_env PYTHON "${WORKSPACE}\\py39\\python.exe"
1010
set_env DIST_PYTHON "${WORKSPACE}\\py39-dist\\python"
11-
set_env PYSIDE2_RCC "${WORKSPACE}\\py39\\Lib\\site-packages\\PySide2\\rcc.exe"
11+
set_env PYSIDE2_RCC "${WORKSPACE}\\py39\\Lib\\site-packages\\PySide6\\rcc.exe"
1212
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-win_amd64.whl
1313
set_env BUILD_TRIPLET "x86_64-pc-windows-msvc"
1414
set_env PYO3_CONFIG_FILE "${WORKSPACE}\\standalone-py\\pyo3_config.txt"
@@ -17,7 +17,7 @@ elseif eq ${os} linux
1717
set_env STANDALONE_PY_URL "${SWFT_PY_BASE_URL}/cpython-3.9.10-x86_64-unknown-linux-gnu-pgo+lto-20220203T2103.tar.zst"
1818
set_env PYTHON "${WORKSPACE}/py39/bin/python3"
1919
set_env DIST_PYTHON "${WORKSPACE}/py39-dist/bin/python3"
20-
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
20+
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside6-rcc"
2121
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-linux_x86_64.whl
2222
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
2323
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
@@ -28,7 +28,7 @@ else
2828
set_env STANDALONE_PY_URL "${PY_BASE_URL}/cpython-3.9.7-x86_64-apple-darwin-pgo+lto-20211017T1616.tar.zst"
2929
set_env PYTHON "${WORKSPACE}/py39/bin/python3"
3030
set_env DIST_PYTHON "${WORKSPACE}/py39-dist/bin/python3"
31-
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
31+
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside6-rcc"
3232
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
3333
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
3434
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
@@ -286,17 +286,7 @@ script_runner = "@duckscript"
286286
script = '''
287287
wget -O py39.tar.zst ${STANDALONE_PY_URL}
288288
exec --fail-on-error zstd -f -d py39.tar.zst
289-
exec --fail-on-error tar -xvf py39.tar
290-
'''
291-
292-
[tasks.install-pyside-wheels]
293-
env = { USE_PYTHON = { value = "${PYTHON}", condition = { env_not_set = [
294-
"USE_PYTHON",
295-
] } }, OS_WHEEL_LABEL = { source = "${OS}", default_value = "unknown", mapping = { "linux" = "abi3-manylinux1_x86_64", "mac" = "abi3-macosx_10_13_intel", "windows" = "none-win_amd64" } } }
296-
script_runner = "@duckscript"
297-
script = '''
298-
exec --fail-on-error ${USE_PYTHON} -m pip install pyside-wheels/shiboken2-5.15.2.2-5.15.2-cp35.cp36.cp37.cp38.cp39.cp310-${OS_WHEEL_LABEL}.whl
299-
exec --fail-on-error ${USE_PYTHON} -m pip install pyside-wheels/PySide2-5.15.2.2-5.15.2-cp35.cp36.cp37.cp38.cp39.cp310-${OS_WHEEL_LABEL}.whl
289+
exec --fail-on-error tar -xf py39.tar
300290
'''
301291

302292
[tasks.setup-builder]
@@ -312,7 +302,6 @@ cp . ../../../py39
312302
cd ../../../
313303
exec --fail-on-error ${PYTHON} ./get-pip.py
314304
exec --fail-on-error ${PYTHON} -m pip install wheel flit . ".[test]"
315-
cm_run_task install-pyside-wheels
316305
cm_run_task generate-resources
317306
'''
318307

@@ -438,7 +427,6 @@ dependencies = ["build-frontend-wheel"]
438427
script_runner = "@duckscript"
439428
script = '''
440429
exec --fail-on-error ${DIST_PYTHON} -m pip install ./dist/swiftnav_console-0.1.0-py3-none-any.whl --force-reinstall
441-
cm_run_task install-pyside-wheels
442430
'''
443431

444432
[tasks.build-dist-install-backend-wheel]
@@ -475,8 +463,8 @@ env = { PYTHONDONTWRITEBYTECODE = "1" }
475463
cwd = "py39-dist"
476464
script_runner = "@duckscript"
477465
script = '''
478-
py_folders = array test tests examples __pycache__ demos turtledemo translations idlelib lib/tcl8 lib/tcl8.6 lib/tk8.6 shiboken2/docs ensurepip lib2to3 tkinter unittest include
479-
qt_folders = array plugins/geoservices plugins/virtualkeyboard plugins/sqldrivers lib/Tix8.4.3 tcl/tix8.4.3 Qt/resources PySide2/resources
466+
py_folders = array test tests examples __pycache__ demos turtledemo translations idlelib lib/tcl8 lib/tcl8.6 lib/tk8.6 shiboken6/docs ensurepip lib2to3 tkinter unittest include
467+
qt_folders = array plugins/geoservices plugins/virtualkeyboard plugins/sqldrivers lib/Tix8.4.3 tcl/tix8.4.3 Qt/resources PySide6/resources
480468
qml_folders = array qml/QtWeb* qml/QtBluetooth* qml/QtNfc* qml/QtGamepad qml/QtTest qml/QtQuick3D qml/Qt3D qml/QtSensors qml/QtLocation qml/QtPositioning
481469
all_folders = array_concat ${py_folders} ${qt_folders} ${qml_folders}
482470
@@ -503,7 +491,9 @@ for ext in ${file_exts}
503491
end
504492
end
505493
506-
libs = array QtSensors QtLocation Qt5Location QtPositioning Qt3D Qt53D Qt5Nfc Qt5Web QtWeb Qt5Pdf Qt5Designer Qt5DesignerComponents Qt5VirtualKeyboard Qt5Bluetooth Qt5Quick3D
494+
libs_a = array Qt3D QtBluetooth QtCconcurrent QtDataVisualization QtDesigner QtHelp QtMultimedia QtNfs QtPositioning
495+
libs_b = array QtQuick3D QtRemoteObjects QtScxml QtSensors QtSerialPort QtSql QtStateMachine QtTest QtUiTools QtWeb QtXml
496+
libs = array_concat ${libs_a} ${libs_b}
507497
508498
for lib in ${libs}
509499
files = glob_array ./**/*${lib}*
@@ -529,7 +519,7 @@ if eq ${os} windows
529519
end
530520
end
531521
532-
qtbins = glob_array ./Lib/site-packages/PySide2/*.exe
522+
qtbins = glob_array ./Lib/site-packages/PySide6/*.exe
533523
for bin in ${qtbins}
534524
rm ${bin}
535525
end
@@ -544,12 +534,36 @@ if eq ${os} windows
544534
end
545535
end
546536
end
537+
elseif eq ${os} mac
538+
rm -r ./share
539+
rm -r ./lib/python3.9/site-packages/PySide6/Qt/libexec
540+
bins = array qmllint lupdate lrelease scripts
541+
for bin in ${bins}
542+
files = glob_array ./lib/python3.9/site-packages/PySide6/${bin}
543+
for bin in ${files}
544+
rm -r ${bin}
545+
end
546+
end
547+
548+
# The Mac signing process needed to be fine tuned. There were a bunch of variations in the paths
549+
# that we purge or sign which needed fixing. Also there were quite a few "Resources" folders buried
550+
# within all of the PySide6 .framework files that were causing issues with the signing. I'm not sure
551+
# if it was simply due to the folder named "Resources" or that each folder contained an Info.plist file.
552+
# That being said after deleting them the app runs fine and passes the mac signing gauntlet.
553+
# See: https://stackoverflow.com/a/29271922/12265938
554+
555+
resources_a = glob_array ./lib/python3.9/site-packages/PySide6/Qt/lib/*.framework/Versions/A/Resources
556+
resources_b = glob_array ./lib/python3.9/site-packages/PySide6/Qt/lib/*.framework/Resources
557+
resources = array_concat ${resources_a} ${resources_b}
558+
for dir in ${resources}
559+
rm -r ${dir}
560+
end
547561
else
548562
rm -r ./share
549563
550-
bins = array rcc uic designer pyside2-lupdate Designer.app
564+
bins = array rcc uic designer pyside6-lupdate Designer.app
551565
for bin in ${bins}
552-
files = glob_array ./**/PySide2/${bin}
566+
files = glob_array ./**/PySide6/${bin}
553567
for bin in ${files}
554568
rm -r ${bin}
555569
end
@@ -582,7 +596,9 @@ else
582596
endif
583597
584598
if eq ${os} mac
585-
rm -r lib/python3.9/site-packages/PySide2/Designer.app/
599+
rm -r lib/python3.9/site-packages/PySide6/Designer.app/
600+
rm -r lib/python3.9/site-packages/PySide6/Assistant.app/
601+
rm -r lib/python3.9/site-packages/PySide6/Linguist.app/
586602
587603
rm lib/python3.9/lib-dynload/_testcapi.cpython-39-darwin.so
588604
rm lib/python3.9/lib-dynload/xxlimited.cpython-39-darwin.so
@@ -593,7 +609,7 @@ if eq ${os} mac
593609
rm -r lib/thread2.8.5/
594610
endif
595611
596-
py_internal_libs = array Lib/email Lib/distutils Lib/http Lib/multiprocessing Lib/msilib Lib/http Lib/dbm Lib/curses Lib/xml Lib/xmlrpc Lib/urllib Lib/ensurepip Lib/venv Lib/wsgiref Lib/lib2to3
612+
py_internal_libs = array Lib/email Lib/distutils Lib/http Lib/multiprocessing Lib/msilib Lib/http Lib/dbm Lib/curses Lib/xml Lib/xmlrpc Lib/ensurepip Lib/venv Lib/wsgiref Lib/lib2to3
597613
598614
for name in ${py_internal_libs}
599615
folders = glob_array **/${name}/
@@ -846,34 +862,36 @@ script = '''
846862
makensis /V4 .\installers\Windows\Installer.nsi
847863
'''
848864

865+
# TODO Fix tool location when available in PySide6 wheels[CPP-799]
849866
[tasks.qml-format]
850867
dependencies = ["set-qml-files", "set-qml-app"]
851868
script_runner = "@shell"
852869
script = '''
853-
${QT_APP}/Qt/bin/qmlformat -i ${QML_FILES}
870+
qmlformat -i ${QML_FILES}
854871
'''
855872

873+
# TODO Fix tool location when available in PySide6 wheels[CPP-799]
856874
[tasks.qml-format.windows]
857875
dependencies = ["set-qml-files", "set-qml-app"]
858876
script_runner = "powershell"
859877
script_extension = "ps1"
860878
script = '''
861-
& ${env:QT_APP}\Qt\bin\qmlformat -i $(-split ${env:QML_FILES})
879+
& qmlformat -i $(-split ${env:QML_FILES})
862880
'''
863881

864882
[tasks.qml-lint]
865883
dependencies = ["set-qml-files", "set-qml-app"]
866884
script_runner = "@shell"
867885
script = '''
868-
${QT_APP}/Qt/bin/qmllint -I ${QT_APP}/../PySide2/Qt/qml/ -I resources/ ${QML_FILES}
886+
${QT_APP}/qmllint -I ${QT_APP}/../PySide6/Qt/qml/ -I resources/ ${QML_FILES}
869887
'''
870888

871889
[tasks.qml-lint.windows]
872890
dependencies = ["set-qml-files", "set-qml-app"]
873891
script_runner = "powershell"
874892
script_extension = "ps1"
875893
script = '''
876-
& ${env:QT_APP}\Qt\bin\qmllint -I ${env:QT_APP}\..\PySide2\Qt\qml -I resources $(-split ${env:QML_FILES})
894+
& ${env:QT_APP}\qmllint -I ${env:QT_APP}\..\PySide6\Qt\qml -I resources $(-split ${env:QML_FILES})
877895
'''
878896

879897
[tasks.qml-format-check]
@@ -990,8 +1008,9 @@ dependencies = [
9901008
]
9911009
run_task = "check-git-diff"
9921010

1011+
# TODO Fix qmllint warnings then add qml-lint back to lint task.[CPP-798]
9931012
[tasks.lint]
994-
dependencies = ["qml-lint", "python-lint", "rust-lint", "format-check"]
1013+
dependencies = ["python-lint", "rust-lint", "format-check"]
9951014

9961015
[tasks.types]
9971016
dependencies = ["python-type-check", "rust-type-check"]

pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[MASTER]
22
jobs=0
3-
extension-pkg-whitelist=PySide2
3+
extension-pkg-whitelist=PySide6
44

55
[MESSAGES CONTROL]
66
# Disable undesired lints here (https://stackoverflow.com/a/4341833/749342)

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ readme = "README.md"
55
classifiers = []
66
requires-python = ">=3.8"
77
dynamic = ['version', 'description']
8-
dependencies = ["pycapnp == 1.1.0"]
8+
dependencies = ["PySide6 == 6.3.1", "pycapnp == 1.1.0"]
99

1010
[project.optional-dependencies]
1111
test = [
@@ -16,7 +16,6 @@ test = [
1616
"pytest ~= 6.2.4",
1717
"setuptools-rust ~= 0.12.1",
1818
"psutil ~= 5.8.0",
19-
"qt5-applications ~= 5.15.2",
2019
"py2many >=0.3",
2120
"types-requests ~= 2.25.0",
2221
]

pyside-wheels/PySide2-5.15.2.1-5.15.2-cp39-cp39-linux_x86_64.whl

Lines changed: 0 additions & 3 deletions
This file was deleted.

pyside-wheels/PySide2-5.15.2.1-5.15.2-cp39-cp39-macosx_10_13_x86_64.whl

Lines changed: 0 additions & 3 deletions
This file was deleted.

pyside-wheels/PySide2-5.15.2.1-5.15.2-cp39-cp39-win_amd64.whl

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)