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"),
|
|
|
|
requirement("stringcase"),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
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-06-16 08:04:59 +02:00
|
|
|
"$(location //pip/stubs:extendsitepkgs)",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
|
|
|
data = [
|
|
|
|
"mypy.ini",
|
2021-06-16 08:04:59 +02:00
|
|
|
"//pip/stubs",
|
|
|
|
"//pip/stubs:extendsitepkgs",
|
2021-10-05 05:53:01 +02:00
|
|
|
"@pyqt6//:__init__.py",
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
2021-06-16 08:04:59 +02:00
|
|
|
env = {"EXTRA_SITE_PACKAGES": "$(location //pip/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-05 05:53:01 +02:00
|
|
|
"@pyqt6//:pkg",
|
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"),
|
|
|
|
"@pyqt5//:pkg",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
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",
|
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(
|
|
|
|
name = "runanki_qt5",
|
|
|
|
srcs = [
|
|
|
|
"bazelfixes.py",
|
|
|
|
"runanki.py",
|
|
|
|
],
|
|
|
|
imports = ["."],
|
|
|
|
main = "runanki.py",
|
|
|
|
deps = [
|
|
|
|
"//pylib/anki",
|
|
|
|
"//qt/aqt:aqt_with_data_qt5",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-04-14 10:06:16 +02:00
|
|
|
py_binary(
|
|
|
|
name = "dmypy",
|
|
|
|
srcs = [
|
|
|
|
"dmypy.py",
|
|
|
|
],
|
|
|
|
data = [
|
|
|
|
# ensure the binary's been built
|
|
|
|
"//pip:dmypy",
|
2021-06-16 08:04:59 +02:00
|
|
|
"//pip/stubs",
|
|
|
|
"//pip/stubs:extendsitepkgs",
|
2021-04-14 10:06:16 +02:00
|
|
|
],
|
2021-06-16 08:04:59 +02:00
|
|
|
env = {"EXTRA_SITE_PACKAGES": "$(location //pip/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"),
|
|
|
|
],
|
|
|
|
)
|