Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ get-pip.py
installers/Windows/*.exe
installers/Linux/*.deb
installers/Windows/NSIS/
/.qt_for_python
/.vscode/launch.json
68 changes: 63 additions & 5 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ if eq ${os} windows
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 DIST_PYSIDE2_RCC "${WORKSPACE}\\py39-dist\\Lib\\site-packages\\PySide2\\rcc.exe"
set_env PYSIDE2_RCC "${WORKSPACE}\\py39\\Lib\\site-packages\\PySide2\\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"
Expand All @@ -16,6 +17,7 @@ elseif eq ${os} linux
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 DIST_PYSIDE2_RCC "${WORKSPACE}/py39-dist/bin/pyside2-rcc"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-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"
Expand All @@ -27,6 +29,7 @@ else
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 DIST_PYSIDE2_RCC "${WORKSPACE}/py39-dist/bin/pyside2-rcc"
set_env PYSIDE2_RCC "${WORKSPACE}/py39/bin/pyside2-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"
Expand Down Expand Up @@ -115,6 +118,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,13 +250,23 @@ 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.get-get-pip]
Expand Down Expand Up @@ -383,15 +406,50 @@ script = '''
touch ./py39-dist/.frozen
'''

[tasks.pre-build-dist]
dependencies = [
"setup-builder",
"prep-dist",
"build-dist-copy-resources",
"build-dist-freeze",
"build-install-pyside",
]

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

[tasks.build-install-pyside]
dependencies = ["clone-pyside-repo"]
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.
if eq ${os} windows
lib = get_env LIB
set_env LIB "${lib};${WORKSPACE}\\py39-dist\\libs"
end
exec --fail-on-error ${DIST_PYTHON} -m pip install setuptools wheel packaging
exec --fail-on-error ${DIST_PYTHON} ${WORKSPACE}/pyside-setup/setup.py install --qt 5.15.2 --qmake=D:/Qt/5.15.2/msvc2019_64/bin/qmake.exe --parallel=8 --relwithdebinfo --standalone --no-examples --skip-docs --module-subset Core,Network,Gui,Qml,Widgets,Charts
'''

[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",
"dist-generate-resources",
# "build-dist-copy-resources",
# "build-dist-freeze",
] },
]

Expand Down
35 changes: 35 additions & 0 deletions README.debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Debugging Swift Toolbox 🧰

## Setup

Follow README.md

# Build the build-dist target

```
cargo make build-dist
```

## Debugging an intermittent crash on startup

# Linux
```
cd py39-dist
for i in {1..1000}; do
rust-gdb -ex='set confirm on' -ex run -ex=quit --args swift-console --log-console --file ../console_backend/tests/data/ins_updates.sbp
echo ${i}
done
```

# macOS

```
cd py39-dist
for i in {1..1000}; do
rust-lldb -o run -o quit -- ./swift-console --log-console --file ../console_backend/tests/data/ins_updates.sbp
echo ${i}
done
```

For your convenience a script is provided that will perform this looped
execution. You can find it at `./debug_intermittent_startup_crash.sh`
17 changes: 17 additions & 0 deletions debug_intermittent_startup_crash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

if [ ! -d py39-dist ]; then
cargo make build-dist
fi
cd py39-dist

trap "echo Ctrl-C pressed, exiting loop. ; exit" SIGINT SIGTERM

for i in {1..1000}; do
if [ $(uname) == "Darwin" ]; then
rust-lldb -o run -o quit -- ./swift-console --log-console --file ../console_backend/tests/data/ins_updates.sbp
else
rust-gdb -ex='set confirm on' -ex run -ex=quit --args swift-console --log-console --file ../console_backend/tests/data/ins_updates.sbp
fi
echo ${i}
done
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ readme = "README.md"
classifiers = []
requires-python = ">=3.8"
dynamic = ['version', 'description']
dependencies = ["PySide2 ~= 5.15.2", "pycapnp ~= 1.1.0"]
dependencies = ["pycapnp ~= 1.1.0"]

[project.optional-dependencies]
test = [
Expand Down
4 changes: 4 additions & 0 deletions swiftnav_console/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import sys
import threading
import time

from typing import List, Any, Optional, Tuple

Expand Down Expand Up @@ -226,7 +227,10 @@


def receive_messages(app_, backend, messages):
start = time.time()
while True:
if time.time() - start > 10:
return app_.quit()
buffer = backend.fetch_message()
if not buffer:
print("terminating GUI loop", file=sys.stderr)
Expand Down