add run-qt5 script to run with 5.x

This commit is contained in:
Damien Elmes 2021-10-05 14:05:53 +10:00
parent a7812dedc0
commit 36fdc607c6
3 changed files with 54 additions and 3 deletions

View File

@ -133,6 +133,20 @@ py_binary(
],
)
py_binary(
name = "runanki_qt5",
srcs = [
"bazelfixes.py",
"runanki.py",
],
imports = ["."],
main = "runanki.py",
deps = [
"//pylib/anki",
"//qt/aqt:aqt_with_data_qt5",
],
)
py_binary(
name = "dmypy",
srcs = [

View File

@ -50,7 +50,6 @@ aqt_deps = [
requirement("waitress"),
requirement("send2trash"),
requirement("jsonschema"),
"@pyqt6//:pkg",
] + select({
"@bazel_tools//src/conditions:host_windows": [
requirement("psutil"),
@ -66,7 +65,9 @@ py_library(
srcs = _py_srcs_and_forms,
data = aqt_core_data,
visibility = ["//visibility:public"],
deps = aqt_deps,
deps = aqt_deps + [
"@pyqt6//:pkg",
],
)
py_library(
@ -74,7 +75,19 @@ py_library(
srcs = _py_srcs_and_forms,
data = aqt_core_data + ["//qt/aqt/data"],
visibility = ["//visibility:public"],
deps = aqt_deps,
deps = aqt_deps + [
"@pyqt6//:pkg",
],
)
py_library(
name = "aqt_with_data_qt5",
srcs = _py_srcs_and_forms,
data = aqt_core_data + ["//qt/aqt/data"],
visibility = ["//visibility:public"],
deps = aqt_deps + [
"@pyqt5//:pkg",
],
)
py_package(

24
run-qt5 Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
run_linux() {
bazel run $BUILDARGS //qt:runanki_qt5 -- $*
}
run_mac() {
# QtWebEngineProcess is unable to locate icudtl.dat from a symlinked tree,
# so we need to copy the files into a working folder before running on a Mac.
workspace=$(dirname $0)
bazel build $BUILDARGS //qt:runanki_qt5 && \
rsync -aiL --exclude=anki/external --delete -f'-p __pycache__' \
$workspace/bazel-bin/qt/runanki* $workspace/bazel-copy/ && \
$workspace/bazel-copy/runanki_qt5 $*
}
export PYTHONWARNINGS=default
if [[ "$OSTYPE" == "darwin"* ]]; then
run_mac $*
else
run_linux $*
fi