Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b4daa93
Pyside build command for building from source.
Jan 8, 2022
c404d49
Add readme showing how to loop-run the debugger
keithel-qt Feb 22, 2022
c3c68eb
Update .gitignore rules for qt for python and vscode
keithel-qt Mar 9, 2022
908c377
Improve pyside build from src for Windows
keithel-qt Mar 10, 2022
443f82d
clone pyside if !found when running pre-build-dist
keithel-qt Mar 10, 2022
f8af009
Add 10sec crash.
john-michaelburke Mar 17, 2022
3cc4672
Only generate resources if they haven't been already.
keithel-qt Mar 25, 2022
ea84ce8
Powershell script for finding crash
keithel-qt Mar 30, 2022
d052ca8
Clone PySide2 v5.15.2.1, right qmake path
keithel-qt Mar 30, 2022
fd40eca
If py39 or py39-dist do not exist use ~/Qt rcc
keithel-qt Mar 31, 2022
884c2bf
Build pyside2 debug
keithel-qt Mar 31, 2022
3728eb5
Fix debug crash loop script
keithel-qt Apr 1, 2022
1eb1e90
Build pyside fully debug
keithel-qt Apr 1, 2022
0e6121d
Add the Qt debug symbols to the PySide installation
keithel-qt Apr 1, 2022
bf2e2e4
Make env var for # concurrent builds
keithel-qt Apr 6, 2022
039a46d
Update the debug readme, debug script
keithel-qt Apr 6, 2022
5459ed8
Allow standard builds alongside pyside debug builds
keithel-qt Apr 6, 2022
f551c76
Add a target that cleans the back end
keithel-qt Apr 6, 2022
1cfdba6
Add exit-after-secs cmdline option to console
keithel-qt Apr 6, 2022
ee7d662
Remove unnecessary erroneous build-dist dependency
keithel-qt Apr 6, 2022
c7a188b
Execute pip freeze to determine if PySide2 installed
keithel-qt Apr 6, 2022
1c47dca
Properly specify qmake_path in build-dist-install-pyside
keithel-qt Apr 7, 2022
3e401d3
generate console_resources before installing wheels
keithel-qt Apr 7, 2022
5df1247
Add console PySide2 debug vagrant environment
keithel-qt Apr 7, 2022
3caf8c9
Vagrant - detect if user didn't supply Qt installer
keithel-qt Apr 7, 2022
7495442
Create a placeholder README.md for the vagrant env
keithel-qt Apr 7, 2022
4b2fd85
Build PySide2 as a wheel, install wheels
keithel-qt Apr 8, 2022
75624cd
Fix arg passing in intermittent crash debug script
keithel-qt Apr 8, 2022
32e2431
Ignore .vagrant directories
keithel-qt Apr 8, 2022
6605034
Allow user to specify location of Qt install
keithel-qt Apr 11, 2022
dbd2dec
Properly install built pyside+shiboken wheels for all platforms
keithel-qt Apr 12, 2022
49c63e7
Fix py_include_dir to point to proper include dir
keithel-qt Apr 12, 2022
9128b2a
Automatic logging of crash debug sessions
keithel-qt Apr 13, 2022
1984b76
allow uname -o to work even if option not exist
keithel-qt Apr 13, 2022
7853aa6
Fix uname -o use, windows comment
keithel-qt Apr 15, 2022
b52229c
Add lldb python api use for iterating
keithel-qt Apr 15, 2022
5b41b44
Fix check of QTDIR (invalid duckscript)
keithel-qt Apr 15, 2022
81bec2c
Properly check for QTDIR env var
keithel-qt Apr 16, 2022
94fcb62
Add crash diagnostic pyside2 patch file
keithel-qt Apr 19, 2022
ad3864d
Simplify which rcc to use
keithel-qt Apr 20, 2022
9cac816
Force reinstallation of pyside and shiboken wheels
keithel-qt Apr 25, 2022
907503d
Include exit-after-timeout to CLI. (#522)
keithel-qt Apr 25, 2022
0f9c2e5
Allow running application without console_backend.
john-michaelburke Apr 20, 2022
af879f5
Add readme.
john-michaelburke Apr 21, 2022
5bfd107
Add pickle file for running without rust
keithel-qt Apr 26, 2022
88e12fe
Qt6 port initial (doesn't work)
keithel-qt Apr 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ get-pip.py
installers/Windows/*.exe
installers/Linux/*.deb
installers/Windows/NSIS/
/.qt_for_python
/.vscode/launch.json
/pyside-setup
.vagrant/
43 changes: 43 additions & 0 deletions 0001-PySide2-Handle-not-finding-a-slot-by-name.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
From 388d1ff980f705aad50650c030c3a6a4ec7a8c01 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <[email protected]>
Date: Tue, 5 Apr 2022 17:09:01 +0200
Subject: [PATCH] PySide6: Handle not finding a slot by name

Pick-to: 6.2 5.15
Change-Id: Ie2c652223aaaa853c99d540acebb99f754f34d61
---
sources/pyside2/libpyside/signalmanager.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp
index 93847e066..496cc2cb1 100644
--- a/sources/pyside2/libpyside/signalmanager.cpp
+++ b/sources/pyside2/libpyside/signalmanager.cpp
@@ -646,6 +646,7 @@ static int callMethod(QObject *object, int id, void **args)
{
const QMetaObject *metaObject = object->metaObject();
QMetaMethod method = metaObject->method(id);
+ int result = -1;

if (method.methodType() == QMetaMethod::Signal) {
// emit python signal
@@ -656,9 +657,14 @@ static int callMethod(QObject *object, int id, void **args)
QByteArray methodName = method.methodSignature();
methodName.truncate(methodName.indexOf('('));
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(self, methodName));
- return SignalManager::callPythonMetaMethod(method, args, pyMethod, false);
+ if (pyMethod.isNull()) {
+ PyErr_Format(PyExc_AttributeError, "Slot '%s::%s' not found.",
+ metaObject->className(), method.methodSignature().constData());
+ } else {
+ result = SignalManager::callPythonMetaMethod(method, args, pyMethod, false);
+ }
}
- return -1;
+ return result;
}


--
2.25.1

171 changes: 148 additions & 23 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,72 @@
env_scripts = [
'''
#!@duckscript
set_env PARALLEL_BUILDS 2
if not is_empty ${QTDIR}
echo "Using user-defined QTDIR ${QTDIR} to find Qt's debug libs and headers for pyside6 build."
end

QTDIR = get_env QTDIR
# set os specific env vars
os = os_family
if eq ${os} windows
if is_empty ${QTDIR}
QTDIR = set "C:/Qt/5.15.2/msvc2019_64"
set_env QTDIR "${QTDIR}"
end
set_env STANDALONE_PY_URL "${PY_BASE_URL}/cpython-3.9.7-x86_64-pc-windows-msvc-shared-pgo-20211017T1616.tar.zst"
set_env PYTHON "${WORKSPACE}\\py39\\python.exe"
set_env DIST_PYTHON "${WORKSPACE}\\py39-dist\\python"
set_env PYSIDE2_RCC "${WORKSPACE}\\py39\\Lib\\site-packages\\PySide2\\rcc.exe"
set_env DIST_PYSIDE2_RCC "${WORKSPACE}\\py39-dist\\Lib\\site-packages\\PySide6\\rcc.exe"
set_env PYSIDE2_RCC "${WORKSPACE}\\py39\\Lib\\site-packages\\PySide6\\rcc.exe"
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-win_amd64.whl
set_env BUILD_TRIPLET "x86_64-pc-windows-msvc"
set_env PYO3_CONFIG_FILE "${WORKSPACE}\\standalone-py\\pyo3_config.txt"
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}\\standalone-py\\pyo3_config.txt"
lib = get_env LIB
set_env LIB "${lib};${WORKSPACE}\\py39-dist\\libs"
set_env QMAKE_PATH "${QTDIR}/bin/qmake.exe"
set_env PYSIDE_WHEEL fill_me_in.whl
set_env SHIBOKEN_WHEEL fill_me_in.whl
elseif eq ${os} linux
if is_empty ${QTDIR}
QTDIR = set "${HOME}/Qt/5.15.2/gcc_64"
set_env QTDIR "${QTDIR}"
end
set_env STANDALONE_PY_URL "${SWFT_PY_BASE_URL}/cpython-3.9.10-x86_64-unknown-linux-gnu-pgo+lto-20220203T2103.tar.zst"
set_env PYTHON "${WORKSPACE}/py39/bin/python3"
set_env DIST_PYTHON "${WORKSPACE}/py39-dist/bin/python3"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
set_env DIST_PYSIDE2_RCC "${WORKSPACE}/py39-dist/bin/pyside6-rcc"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside6-rcc"
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-linux_x86_64.whl
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
output = exec --fail-on-error gcc -dumpmachine
triplet = trim ${output.stdout}
set_env BUILD_TRIPLET ${triplet}
set_env QMAKE_PATH "${QTDIR}/bin/qmake"
set_env PYSIDE_WHEEL PySide6-5.15.2.1-5.15.2-cp39-cp39-linux_x86_64.whl
set_env SHIBOKEN_WHEEL shiboken6-5.15.2.1-5.15.2-cp39-cp39-linux_x86_64.whl
else
if is_empty ${QTDIR}
QTDIR = set "${HOME}/Qt/5.15.2/clang_64"
set_env QTDIR "${QTDIR}"
end
set_env STANDALONE_PY_URL "${PY_BASE_URL}/cpython-3.9.7-x86_64-apple-darwin-pgo+lto-20211017T1616.tar.zst"
set_env PYTHON "${WORKSPACE}/py39/bin/python3"
set_env DIST_PYTHON "${WORKSPACE}/py39-dist/bin/python3"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-rcc"
set_env DIST_PYSIDE2_RCC "${WORKSPACE}/py39-dist/bin/pyside6-rcc"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside6-rcc"
set_env BACKEND_WHEEL console_backend-0.1.0-cp39-cp39-macosx_10_15_x86_64.whl
set_env PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config.txt"
set_env CONSOLE_PYO3_CONFIG_FILE "${WORKSPACE}/standalone-py/pyo3_config_console.txt"
output = exec --fail-on-error gcc -dumpmachine
triplet = trim ${output.stdout}
set_env BUILD_TRIPLET ${triplet}
# Below needs to be specified for macOS - I'm not sure where it is installed on macOS
set_env QMAKE_PATH "${QTDIR}/bin/qmake"
set_env PYSIDE_WHEEL PySide6-5.15.2.1-5.15.2-cp39-cp39-macosx_10_13_x86_64.whl
set_env SHIBOKEN_WHEEL shiboken6-5.15.2.1-5.15.2-cp39-cp39-macosx_10_13_x86_64.whl
end
''',
]
Expand Down Expand Up @@ -115,6 +148,16 @@ writefile /tmp/piksi_tools_constants.py ${output.stdout}
exec --fail-on-error ${python} -m py2many --rust=1 /tmp/piksi_tools_constants.py --outdir console_backend/src/
'''

[tasks.dist-generate-resources]
command = "${DIST_PYSIDE2_RCC}"
args = [
"resources/console_resources.qrc",
"-o",
"swiftnav_console/console_resources.py",
"-g",
"python",
]

[tasks.generate-resources]
command = "${PYSIDE2_RCC}"
args = [
Expand Down Expand Up @@ -237,15 +280,31 @@ args = [
"./console_backend",
]

[tasks.dist-install-pip-flit]
command = "${DIST_PYTHON}"
args = ["-m", "pip", "install", "flit"]

[tasks.build-frontend-wheel]
command = "${PYTHON}"
dependencies = ["dist-install-pip-flit"]
command = "${DIST_PYTHON}"
args = ["-m", "flit", "build", "--no-setup-py"]

[tasks.dist-install-pip-setuptools-rust]
command = "${DIST_PYTHON}"
args = ["-m", "pip", "install", "setuptools_rust"]

[tasks.build-backend-wheel]
dependencies = ["dist-install-pip-setuptools-rust"]
cwd = "console_backend"
command = "${PYTHON}"
command = "${DIST_PYTHON}"
args = ["setup.py", "-vv", "bdist_wheel"]

[tasks.clean-backend]
dependencies = ["dist-install-pip-setuptools-rust"]
cwd = "console_backend"
command = "${DIST_PYTHON}"
args = ["setup.py", "-vv", "clean"]

[tasks.get-get-pip]
script_runner = "@duckscript"
script = '''
Expand Down Expand Up @@ -304,7 +363,13 @@ cp . ../../../py39
cd ../../../
exec --fail-on-error ${PYTHON} ./get-pip.py
exec --fail-on-error ${PYTHON} -m pip install wheel flit . ".[test]"
cm_run_task generate-resources

# If pyside-setup exists, then assume user wants to build and install pyside6
if is_path_exists "${WORKSPACE}/pyside-setup/setup.py"
cm_run_task build-install-pyside
else
exec --fail-on-error ${PYTHON} -m pip install PySide6==6.3.0
end
'''

[tasks.prep-dist]
Expand All @@ -320,6 +385,14 @@ cd standalone-py/python/install/
cp . ../../../py39-dist
cd ../../..
exec --fail-on-error ${DIST_PYTHON} ./get-pip.py

# If pyside-setup exists, then assume user wants to build and install pyside6
if is_path_exists "${WORKSPACE}/pyside-setup/setup.py"
# This will install to both dist and non-dist python
cm_run_task build-dist-install-pyside
else
exec --fail-on-error ${DIST_PYTHON} -m pip install PySide6==6.3.0
end
'''

[tasks.call-build-console-bin]
Expand Down Expand Up @@ -383,25 +456,77 @@ script = '''
touch ./py39-dist/.frozen
'''

[tasks.build-dist]
dependencies = ["prep-dist"]
run_task = [
{ name = [
"build-dist-install-frontend-wheel",
"build-dist-install-backend-wheel",
"build-dist-install-console",
"build-dist-copy-resources",
"build-dist-freeze",
] },
[tasks.pre-build-dist]
dependencies = [
"setup-builder",
"prep-dist",
"build-dist-copy-resources",
"build-dist-freeze",
]

[tasks.prep-debug-pyside]
condition = { files_not_exist = ["${WORKSPACE}/pyside-setup/setup.py"] }
script_runner = "@duckscript"
script = '''
exec --fail-on-error git clone -b v5.15.2.1 http://code.qt.io/pyside/pyside-setup.git
'''

[tasks.build-pyside]
condition = { files_not_exist = ["${WORKSPACE}/pyside-setup/dist/${PYSIDE_WHEEL}"] }
dependencies = ["prep-debug-pyside"]
script_runner = "@duckscript"
script = '''
# Note: To make build-install-pyside work on Windows, you need to run from a powershell or cmd shell
# that is a VS2019 or other visual studio command line (vcvars*.bat needs to be sourced).
# To set up a powershell with the Visual Studio environment, run these two commands:
# Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
# Enter-VsDevShell -VsInstanceId fdbeecbc -SkipAutomaticLocation -DevCmdArguments '-arch=x64 -no_logo'
# You may also need to add `jom` to the path to allow parallel builds to work. You can find this installed
# in a standard Qt installation in the Qt\Tools\QtCreator\bin\jom directory.
exec --fail-on-error ${PYTHON} -m pip install setuptools wheel packaging
exec --fail-on-error ${PYTHON} ${WORKSPACE}/pyside-setup/setup.py bdist_wheel --debug --qt 5.15.2 --qmake=${QMAKE_PATH} --parallel=${PARALLEL_BUILDS} --no-examples --skip-docs --module-subset Core,Network,Gui,Qml,Widgets,Charts
'''

[tasks.build-dist-install-pyside]
dependencies = ["build-pyside"]
script_runner = "@duckscript"
script = '''
exec --fail-on-error ${DIST_PYTHON} -m pip install setuptools wheel packaging
exec --fail-on-error ${DIST_PYTHON} -m pip install --force-reinstall ${WORKSPACE}/pyside-setup/dist/${SHIBOKEN_WHEEL} ${WORKSPACE}/pyside-setup/dist/${PYSIDE_WHEEL}
'''

[tasks.build-install-pyside]
dependencies = ["build-pyside"]
script_runner = "@duckscript"
script = '''
exec --fail-on-error ${PYTHON} -m pip install --force-reinstall ${WORKSPACE}/pyside-setup/dist/${SHIBOKEN_WHEEL} ${WORKSPACE}/pyside-setup/dist/${PYSIDE_WHEEL}
'''

[tasks.build-dist]
script_runner = "@duckscript"
script = '''
if is_path_exists ${DIST_PYTHON}
output = exec --fail-on-error ${DIST_PYTHON} -m pip freeze
out = set ${output.stdout}
if not contains "${out}" "PySide6=="
cm_run_task pre-build-dist
end
else
cm_run_task pre-build-dist
end
cm_run_task dist-generate-resources
cm_run_task build-dist-install-frontend-wheel
cm_run_task build-dist-install-backend-wheel
cm_run_task build-dist-install-console
'''

[tasks.purge-dist]
env = { PYTHONDONTWRITEBYTECODE = "1" }
cwd = "py39-dist"
script_runner = "@duckscript"
script = '''
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
qt_folders = array plugins/geoservices plugins/virtualkeyboard plugins/sqldrivers lib/Tix8.4.3 tcl/tix8.4.3 Qt/resources PySide2/resources
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
qt_folders = array plugins/geoservices plugins/virtualkeyboard plugins/sqldrivers lib/Tix8.4.3 tcl/tix8.4.3 Qt/resources PySide6/resources
qml_folders = array qml/QtWeb* qml/QtBluetooth* qml/QtNfc* qml/QtGamepad qml/QtTest qml/QtQuick3D qml/Qt3D qml/QtSensors qml/QtLocation qml/QtPositioning
all_folders = array_concat ${py_folders} ${qt_folders} ${qml_folders}
for name in ${all_folders}
Expand Down Expand Up @@ -449,16 +574,16 @@ if eq ${os} windows
rm ${file}
end
end
qtbins = glob_array ./Lib/site-packages/PySide2/*.exe
qtbins = glob_array ./Lib/site-packages/PySide6/*.exe
for bin in ${qtbins}
rm ${bin}
end
else
rm -r ./share

bins = array rcc uic designer pyside2-lupdate Designer.app
bins = array rcc uic designer pyside6-lupdate Designer.app
for bin in ${bins}
files = glob_array ./**/PySide2/${bin}
files = glob_array ./**/PySide6/${bin}
for bin in ${files}
rm -r ${bin}
end
Expand Down Expand Up @@ -758,15 +883,15 @@ script = '''
dependencies = ["set-qml-files", "set-qml-app"]
script_runner = "@shell"
script = '''
${QT_APP}/Qt/bin/qmllint -I ${QT_APP}/../PySide2/Qt/qml/ -I resources/ ${QML_FILES}
${QT_APP}/Qt/bin/qmllint -I ${QT_APP}/../PySide6/Qt/qml/ -I resources/ ${QML_FILES}
'''

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

[tasks.qml-format-check]
Expand Down
62 changes: 62 additions & 0 deletions README.debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Debugging Swift Toolbox 🧰

## Install Qt

To build PySide, you need a copy of the Qt libraries, headers, and tools that
matches the version of PySide2/6 that you are wanting to install.

### Get Qt installer (Commercial Qt License holder)
* Point a browser to https://account.qt.io/ and create or log into your Qt account
* From the `Downloads` link, pick your license. Likely you only have one choice.
If you have a choice of licenses, pick "Qt for Device Creation" or the one for
desktop application development.
* For product, choose `Qt Online Installer`
* Leave version untouched.
* Click the download button.

### Get Qt installer (LGPLv3 or trial installation)
* Make sure that you will be in compliance with the terms of the LGPLv3.
* Point a browser to https://qt.io/download
* Click "Download. Try." at the top.
* Fill out the form that comes up. The Qt Company will not sell your personal
information to third parties. You may be contacted by a sales person, however.
* The next page after form submission will have links to download the installer.
* Click the download button.

### Installing Qt
* On *nix operating systems, make sure you `chmod u+x qt-unified-os-n.n.n-n.run`
to give the installer ability to be run as an executable.
* Run the installer .exe or .run package.
* Log in if you're a license holder.
* Choose "Add or Remove components" if you encounter that choice.
* On the component selections screen, enable the "Archive" and "LTS" filter
choices and disable the "Latest releases" and "Preview" filter choices on the
right hand side and click "Filter". This will take some time.
* Open the Qt->Qt 5.15.2 tree view component branches.
* In this grouping, select the following:
* The component that matches your compiler and architecture (for example,
gcc_64 or MSVC 2019 64-bit)
* Qt Charts
* Sources
* Qt Debug Information Files
* Click Next, and review and agree to any licenses.
* Click "Install".
* Qt will then install to the default location. Makefile.toml assumes Qt is
installed to the default installation, so if you do modify that, review
the pyside targets in Makefile.toml and update the paths accordingly.

## Get the swift-console ready for building

* Follow README.md


## Build the build-dist target

```
cargo make prep-debug-pyside
cargo make build-dist
```

## Debugging an intermittent crash on startup

For all platforms, just use the `utils/debug_intermittent_startup_crash.sh` script.
Loading