2020-11-01 05:26:58 +01:00
|
|
|
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
|
|
|
|
load("@py_deps//:requirements.bzl", "requirement")
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
name = "genhooks_gui",
|
|
|
|
srcs = [
|
|
|
|
"tools/genhooks_gui.py",
|
|
|
|
],
|
|
|
|
imports = ["."],
|
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
deps = [
|
2020-11-02 07:28:31 +01:00
|
|
|
"//pylib/tools:hookslib",
|
2020-11-01 05:26:58 +01:00
|
|
|
requirement("black"),
|
2021-10-21 06:54:50 +02:00
|
|
|
"//pylib/anki/_vendor:stringcase",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
name = "extract_sass_colors",
|
|
|
|
srcs = [
|
|
|
|
"tools/extract_sass_colors.py",
|
|
|
|
],
|
|
|
|
imports = ["."],
|
|
|
|
visibility = [":__subpackages__"],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "pytest",
|
2020-11-02 12:34:48 +01:00
|
|
|
srcs = glob(["tests/*.py"]) + ["bazelfixes.py"],
|
|
|
|
imports = ["."],
|
2020-11-01 05:26:58 +01:00
|
|
|
main = "tests/run_pytest.py",
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt:aqt_without_data",
|
2020-11-01 05:26:58 +01:00
|
|
|
requirement("pytest"),
|
|
|
|
requirement("mock"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "mypy",
|
|
|
|
srcs = [
|
|
|
|
"tests/run_mypy.py",
|
|
|
|
],
|
|
|
|
args = [
|
|
|
|
"aqt",
|
|
|
|
"$(location mypy.ini)",
|
2021-10-05 05:53:01 +02:00
|
|
|
"$(location @pyqt6//:__init__.py)",
|
2021-10-18 11:50:40 +02:00
|
|
|
"$(location //python/stubs:extendsitepkgs)",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
data = [
|
|
|
|
"mypy.ini",
|
2021-10-18 11:50:40 +02:00
|
|
|
"//python/stubs",
|
|
|
|
"//python/stubs:extendsitepkgs",
|
2021-10-05 05:53:01 +02:00
|
|
|
"@pyqt6//:__init__.py",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
2021-10-18 11:50:40 +02:00
|
|
|
env = {"EXTRA_SITE_PACKAGES": "$(location //python/stubs)"},
|
2020-11-01 05:26:58 +01:00
|
|
|
main = "tests/run_mypy.py",
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt:aqt_without_data",
|
2021-10-23 02:56:17 +02:00
|
|
|
"@pyqt6",
|
2020-11-01 05:26:58 +01:00
|
|
|
requirement("mypy"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
|
|
|
name = "pylint",
|
|
|
|
srcs = [
|
|
|
|
"tests/run_pylint.py",
|
|
|
|
],
|
|
|
|
args = [
|
|
|
|
"aqt",
|
|
|
|
"$(location .pylintrc)",
|
|
|
|
],
|
|
|
|
data = [
|
|
|
|
".pylintrc",
|
|
|
|
],
|
|
|
|
main = "tests/run_pylint.py",
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt:aqt_without_data",
|
2020-11-01 05:26:58 +01:00
|
|
|
requirement("pylint"),
|
2021-10-23 02:56:17 +02:00
|
|
|
"@pyqt6",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_test(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "format_check",
|
2020-12-16 02:36:42 +01:00
|
|
|
srcs = glob(["**/*.py"]) + [
|
|
|
|
"//qt/aqt:py_source_files",
|
|
|
|
],
|
2020-11-01 05:26:58 +01:00
|
|
|
args = [
|
|
|
|
"$(location .isort.cfg)",
|
|
|
|
],
|
|
|
|
data = [".isort.cfg"],
|
|
|
|
main = "tests/run_format.py",
|
|
|
|
deps = [
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt:aqt_without_data",
|
2020-11-01 05:26:58 +01:00
|
|
|
requirement("black"),
|
|
|
|
requirement("isort"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_binary(
|
2020-11-12 11:11:40 +01:00
|
|
|
name = "format",
|
2020-11-01 05:26:58 +01:00
|
|
|
srcs = [
|
|
|
|
"tests/run_format.py",
|
|
|
|
],
|
|
|
|
args = [
|
|
|
|
"$(location .isort.cfg)",
|
|
|
|
"fix",
|
|
|
|
],
|
|
|
|
data = [".isort.cfg"],
|
|
|
|
main = "tests/run_format.py",
|
|
|
|
tags = ["manual"],
|
|
|
|
deps = [
|
|
|
|
requirement("black"),
|
|
|
|
requirement("isort"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
name = "runanki",
|
2020-11-02 12:34:48 +01:00
|
|
|
srcs = [
|
|
|
|
"bazelfixes.py",
|
|
|
|
"runanki.py",
|
|
|
|
],
|
2020-11-01 05:26:58 +01:00
|
|
|
imports = ["."],
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt:aqt_with_data",
|
2021-10-23 02:56:17 +02:00
|
|
|
"@pyqt6",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
)
|
2020-12-17 03:03:24 +01:00
|
|
|
|
2021-10-05 06:05:53 +02:00
|
|
|
py_binary(
|
2021-10-23 02:56:17 +02:00
|
|
|
name = "runanki_qt515",
|
2021-10-05 06:05:53 +02:00
|
|
|
srcs = [
|
|
|
|
"bazelfixes.py",
|
|
|
|
"runanki.py",
|
|
|
|
],
|
|
|
|
imports = ["."],
|
|
|
|
main = "runanki.py",
|
2021-10-16 08:54:34 +02:00
|
|
|
tags = ["manual"],
|
2021-10-05 06:05:53 +02:00
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
2021-10-23 02:56:17 +02:00
|
|
|
"//qt/aqt:aqt_with_data",
|
|
|
|
"@pyqt515",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
py_binary(
|
|
|
|
name = "runanki_qt514",
|
|
|
|
srcs = [
|
|
|
|
"bazelfixes.py",
|
|
|
|
"runanki.py",
|
|
|
|
],
|
|
|
|
imports = ["."],
|
|
|
|
main = "runanki.py",
|
|
|
|
tags = ["manual"],
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
|
|
|
"//qt/aqt:aqt_with_data",
|
|
|
|
"@pyqt514",
|
2021-10-05 06:05:53 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-04-14 10:06:16 +02:00
|
|
|
py_binary(
|
|
|
|
name = "dmypy",
|
|
|
|
srcs = [
|
|
|
|
"dmypy.py",
|
|
|
|
],
|
|
|
|
data = [
|
|
|
|
# ensure the binary's been built
|
2021-10-18 11:50:40 +02:00
|
|
|
"//python:dmypy",
|
|
|
|
"//python/stubs",
|
|
|
|
"//python/stubs:extendsitepkgs",
|
2021-04-14 10:06:16 +02:00
|
|
|
],
|
2021-10-18 11:50:40 +02:00
|
|
|
env = {"EXTRA_SITE_PACKAGES": "$(location //python/stubs)"},
|
2021-04-14 10:06:16 +02:00
|
|
|
imports = ["."],
|
|
|
|
tags = ["manual"],
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
|
|
|
"//qt/aqt:aqt_without_data",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-12-17 03:03:24 +01:00
|
|
|
py_binary(
|
|
|
|
name = "profile",
|
|
|
|
srcs = ["tools/profile.py"],
|
|
|
|
tags = ["manual"],
|
|
|
|
deps = [
|
|
|
|
requirement("snakeviz"),
|
|
|
|
],
|
|
|
|
)
|