2020-11-01 05:26:58 +01:00
|
|
|
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
|
|
|
load("@rules_python//python:defs.bzl", "py_library")
|
|
|
|
load("@py_deps//:requirements.bzl", "requirement")
|
2020-11-03 23:44:47 +01:00
|
|
|
load("@rules_python//experimental/python:wheel.bzl", "py_package", "py_wheel")
|
|
|
|
load("//:defs.bzl", "anki_version")
|
2020-11-01 05:26:58 +01:00
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "hooks_gen",
|
|
|
|
outs = ["hooks_gen.py"],
|
|
|
|
cmd = "$(location //qt:genhooks_gui) $@",
|
|
|
|
tools = ["//qt:genhooks_gui"],
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "extract_sass_colors",
|
|
|
|
srcs = [
|
|
|
|
"//ts/sass:_vars.scss",
|
|
|
|
],
|
|
|
|
outs = ["colors.py"],
|
|
|
|
cmd = "$(location //qt:extract_sass_colors) $< $@",
|
|
|
|
tools = [
|
|
|
|
"//qt:extract_sass_colors",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-12-16 02:36:42 +01:00
|
|
|
_py_srcs = glob(
|
|
|
|
[
|
|
|
|
"**/*.py",
|
|
|
|
],
|
|
|
|
exclude = ["hooks_gen.py"],
|
|
|
|
)
|
|
|
|
|
|
|
|
_py_srcs_and_forms = _py_srcs + [
|
2020-11-03 23:44:47 +01:00
|
|
|
"//qt/aqt/forms:forms",
|
|
|
|
"//qt/aqt/forms:icons",
|
|
|
|
]
|
|
|
|
|
|
|
|
aqt_core_data = [
|
|
|
|
"colors.py",
|
|
|
|
"py.typed",
|
|
|
|
":hooks_gen",
|
|
|
|
]
|
|
|
|
|
|
|
|
aqt_deps = [
|
|
|
|
requirement("protobuf"),
|
|
|
|
requirement("decorator"),
|
|
|
|
requirement("requests"),
|
|
|
|
requirement("beautifulsoup4"),
|
|
|
|
requirement("flask"),
|
|
|
|
requirement("flask-cors"),
|
|
|
|
requirement("waitress"),
|
|
|
|
requirement("send2trash"),
|
|
|
|
requirement("markdown"),
|
|
|
|
requirement("jsonschema"),
|
|
|
|
"@pyqt5//:pkg",
|
|
|
|
] + select({
|
|
|
|
"@bazel_tools//src/conditions:host_windows": [
|
|
|
|
requirement("psutil"),
|
|
|
|
requirement("pywin32"),
|
2020-12-20 01:54:51 +01:00
|
|
|
requirement("winrt"),
|
2020-11-01 05:26:58 +01:00
|
|
|
],
|
2020-11-03 23:44:47 +01:00
|
|
|
"//conditions:default": [],
|
|
|
|
})
|
|
|
|
|
|
|
|
# library without web/i18n data; faster for testing
|
|
|
|
py_library(
|
|
|
|
name = "aqt_without_data",
|
2020-12-16 02:36:42 +01:00
|
|
|
srcs = _py_srcs_and_forms,
|
2020-11-03 23:44:47 +01:00
|
|
|
data = aqt_core_data,
|
2020-11-01 05:26:58 +01:00
|
|
|
visibility = ["//visibility:public"],
|
2020-11-03 23:44:47 +01:00
|
|
|
deps = aqt_deps,
|
|
|
|
)
|
|
|
|
|
|
|
|
py_library(
|
|
|
|
name = "aqt_with_data",
|
2020-12-16 02:36:42 +01:00
|
|
|
srcs = _py_srcs_and_forms,
|
2020-11-03 23:44:47 +01:00
|
|
|
data = aqt_core_data + ["//qt/aqt/data"],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
deps = aqt_deps,
|
2020-11-01 05:26:58 +01:00
|
|
|
)
|
|
|
|
|
2020-11-03 23:44:47 +01:00
|
|
|
py_package(
|
|
|
|
name = "aqt_pkg",
|
|
|
|
packages = [
|
|
|
|
"qt.aqt",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":aqt_with_data",
|
|
|
|
],
|
|
|
|
)
|
2020-11-01 05:26:58 +01:00
|
|
|
|
2020-11-03 23:44:47 +01:00
|
|
|
py_wheel(
|
|
|
|
name = "wheel",
|
|
|
|
description_file = "wheel_description.txt",
|
|
|
|
distribution = "aqt",
|
2020-12-07 02:22:31 +01:00
|
|
|
entry_points = {
|
|
|
|
"console_scripts": ["anki = aqt:run"],
|
|
|
|
},
|
2020-11-03 23:44:47 +01:00
|
|
|
homepage = "https://apps.ankiweb.net",
|
|
|
|
license = "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
|
2020-11-05 11:12:38 +01:00
|
|
|
python_tag = "py3",
|
2020-11-03 23:44:47 +01:00
|
|
|
python_version = ">=3.8",
|
|
|
|
requires = [
|
|
|
|
"beautifulsoup4",
|
|
|
|
"requests",
|
|
|
|
"send2trash",
|
|
|
|
"markdown",
|
|
|
|
"jsonschema",
|
|
|
|
"flask",
|
|
|
|
"flask_cors",
|
|
|
|
"waitress",
|
2020-11-10 07:29:11 +01:00
|
|
|
"pyqt5>=5.12",
|
|
|
|
"pyqtwebengine",
|
2020-11-03 23:44:47 +01:00
|
|
|
'psutil; sys.platform == "win32"',
|
|
|
|
'pywin32; sys.platform == "win32"',
|
2020-12-23 11:27:31 +01:00
|
|
|
'winrt==1.0.20239.1; sys.platform == "win32" and platform_release == "10" and python_version == "3.8"',
|
|
|
|
'winrt; sys.platform == "win32" and platform_release == "10" and python_version >= "3.9"',
|
2020-11-05 11:12:38 +01:00
|
|
|
"anki==" + anki_version,
|
2020-11-03 23:44:47 +01:00
|
|
|
],
|
|
|
|
strip_path_prefixes = [
|
2020-12-10 14:02:18 +01:00
|
|
|
"qt/",
|
2020-11-03 23:44:47 +01:00
|
|
|
],
|
2020-12-21 10:28:47 +01:00
|
|
|
tags = ["manual"],
|
2020-11-03 23:44:47 +01:00
|
|
|
version = anki_version,
|
2020-12-10 11:27:21 +01:00
|
|
|
visibility = ["//visibility:public"],
|
2020-11-03 23:44:47 +01:00
|
|
|
deps = [
|
|
|
|
":aqt_pkg",
|
|
|
|
],
|
|
|
|
)
|
2020-11-11 12:06:51 +01:00
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "py_source_files",
|
2020-12-16 02:36:42 +01:00
|
|
|
srcs = _py_srcs,
|
2020-11-11 12:06:51 +01:00
|
|
|
visibility = [
|
2020-12-16 02:36:42 +01:00
|
|
|
"//qt:__subpackages__",
|
2020-11-11 12:06:51 +01:00
|
|
|
],
|
|
|
|
)
|