forked from EVerest/everest-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequirements.bzl
executable file
·84 lines (63 loc) · 9.32 KB
/
requirements.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
"""Starlark representation of locked requirements.
@generated by rules_python pip_parse repository rule
from @//:requirements-bazel.txt
"""
load("@rules_python//python:pip.bzl", "pip_utils")
load("@rules_python//python/pip_install:pip_repository.bzl", "group_library", "whl_library")
all_requirements = ["@everest-testing_pip_deps//attrs:pkg", "@everest-testing_pip_deps//cffi:pkg", "@everest-testing_pip_deps//cryptography:pkg", "@everest-testing_pip_deps//exceptiongroup:pkg", "@everest-testing_pip_deps//importlib_resources:pkg", "@everest-testing_pip_deps//iniconfig:pkg", "@everest-testing_pip_deps//jinja2:pkg", "@everest-testing_pip_deps//jsonschema:pkg", "@everest-testing_pip_deps//jsonschema_specifications:pkg", "@everest-testing_pip_deps//markupsafe:pkg", "@everest-testing_pip_deps//ocpp:pkg", "@everest-testing_pip_deps//packaging:pkg", "@everest-testing_pip_deps//paho_mqtt:pkg", "@everest-testing_pip_deps//pkgutil_resolve_name:pkg", "@everest-testing_pip_deps//pluggy:pkg", "@everest-testing_pip_deps//pycparser:pkg", "@everest-testing_pip_deps//pyftpdlib:pkg", "@everest-testing_pip_deps//pyopenssl:pkg", "@everest-testing_pip_deps//pyrsistent:pkg", "@everest-testing_pip_deps//pytest:pkg", "@everest-testing_pip_deps//pytest_asyncio:pkg", "@everest-testing_pip_deps//python_dateutil:pkg", "@everest-testing_pip_deps//pyyaml:pkg", "@everest-testing_pip_deps//pyyaml:pkg", "@everest-testing_pip_deps//referencing:pkg", "@everest-testing_pip_deps//rpds_py:pkg", "@everest-testing_pip_deps//six:pkg", "@everest-testing_pip_deps//stringcase:pkg", "@everest-testing_pip_deps//tomli:pkg", "@everest-testing_pip_deps//websockets:pkg", "@everest-testing_pip_deps//zipp:pkg"]
all_whl_requirements_by_package = {"attrs": "@everest-testing_pip_deps//attrs:whl", "cffi": "@everest-testing_pip_deps//cffi:whl", "cryptography": "@everest-testing_pip_deps//cryptography:whl", "exceptiongroup": "@everest-testing_pip_deps//exceptiongroup:whl", "importlib_resources": "@everest-testing_pip_deps//importlib_resources:whl", "iniconfig": "@everest-testing_pip_deps//iniconfig:whl", "jinja2": "@everest-testing_pip_deps//jinja2:whl", "jsonschema": "@everest-testing_pip_deps//jsonschema:whl", "jsonschema_specifications": "@everest-testing_pip_deps//jsonschema_specifications:whl", "markupsafe": "@everest-testing_pip_deps//markupsafe:whl", "ocpp": "@everest-testing_pip_deps//ocpp:whl", "packaging": "@everest-testing_pip_deps//packaging:whl", "paho_mqtt": "@everest-testing_pip_deps//paho_mqtt:whl", "pkgutil_resolve_name": "@everest-testing_pip_deps//pkgutil_resolve_name:whl", "pluggy": "@everest-testing_pip_deps//pluggy:whl", "pycparser": "@everest-testing_pip_deps//pycparser:whl", "pyftpdlib": "@everest-testing_pip_deps//pyftpdlib:whl", "pyopenssl": "@everest-testing_pip_deps//pyopenssl:whl", "pyrsistent": "@everest-testing_pip_deps//pyrsistent:whl", "pytest": "@everest-testing_pip_deps//pytest:whl", "pytest_asyncio": "@everest-testing_pip_deps//pytest_asyncio:whl", "python_dateutil": "@everest-testing_pip_deps//python_dateutil:whl", "pyyaml": "@everest-testing_pip_deps//pyyaml:whl", "referencing": "@everest-testing_pip_deps//referencing:whl", "rpds_py": "@everest-testing_pip_deps//rpds_py:whl", "six": "@everest-testing_pip_deps//six:whl", "stringcase": "@everest-testing_pip_deps//stringcase:whl", "tomli": "@everest-testing_pip_deps//tomli:whl", "websockets": "@everest-testing_pip_deps//websockets:whl", "zipp": "@everest-testing_pip_deps//zipp:whl"}
all_whl_requirements = all_whl_requirements_by_package.values()
all_data_requirements = ["@everest-testing_pip_deps//attrs:data", "@everest-testing_pip_deps//cffi:data", "@everest-testing_pip_deps//cryptography:data", "@everest-testing_pip_deps//exceptiongroup:data", "@everest-testing_pip_deps//importlib_resources:data", "@everest-testing_pip_deps//iniconfig:data", "@everest-testing_pip_deps//jinja2:data", "@everest-testing_pip_deps//jsonschema:data", "@everest-testing_pip_deps//jsonschema_specifications:data", "@everest-testing_pip_deps//markupsafe:data", "@everest-testing_pip_deps//ocpp:data", "@everest-testing_pip_deps//packaging:data", "@everest-testing_pip_deps//paho_mqtt:data", "@everest-testing_pip_deps//pkgutil_resolve_name:data", "@everest-testing_pip_deps//pluggy:data", "@everest-testing_pip_deps//pycparser:data", "@everest-testing_pip_deps//pyftpdlib:data", "@everest-testing_pip_deps//pyopenssl:data", "@everest-testing_pip_deps//pyrsistent:data", "@everest-testing_pip_deps//pytest:data", "@everest-testing_pip_deps//pytest_asyncio:data", "@everest-testing_pip_deps//python_dateutil:data", "@everest-testing_pip_deps//pyyaml:data", "@everest-testing_pip_deps//pyyaml:data", "@everest-testing_pip_deps//referencing:data", "@everest-testing_pip_deps//rpds_py:data", "@everest-testing_pip_deps//six:data", "@everest-testing_pip_deps//stringcase:data", "@everest-testing_pip_deps//tomli:data", "@everest-testing_pip_deps//websockets:data", "@everest-testing_pip_deps//zipp:data"]
_packages = [("everest-testing_pip_deps_pytest", "pytest==7.2.2"), ("everest-testing_pip_deps_pytest_asyncio", "pytest-asyncio==0.21.0"), ("everest-testing_pip_deps_python_dateutil", "python-dateutil==2.8.2"), ("everest-testing_pip_deps_paho_mqtt", "paho-mqtt==1.6.1"), ("everest-testing_pip_deps_pyftpdlib", "pyftpdlib==1.5.7"), ("everest-testing_pip_deps_ocpp", "ocpp==0.17.0"), ("everest-testing_pip_deps_websockets", "websockets==10.4"), ("everest-testing_pip_deps_pyopenssl", "pyOpenSSL==23.0.0"), ("everest-testing_pip_deps_cryptography", "cryptography==39.0.2"), ("everest-testing_pip_deps_packaging", "packaging==23.0"), ("everest-testing_pip_deps_pycparser", "pycparser==2.21"), ("everest-testing_pip_deps_attrs", "attrs>=22.2.0"), ("everest-testing_pip_deps_cffi", "cffi==1.15.1"), ("everest-testing_pip_deps_exceptiongroup", "exceptiongroup==1.1.1"), ("everest-testing_pip_deps_iniconfig", "iniconfig==2.0.0"), ("everest-testing_pip_deps_jsonschema", "jsonschema==4.17.3"), ("everest-testing_pip_deps_jsonschema_specifications", "jsonschema-specifications==2023.11.1"), ("everest-testing_pip_deps_pluggy", "pluggy==1.0.0"), ("everest-testing_pip_deps_pyrsistent", "pyrsistent==0.19.3"), ("everest-testing_pip_deps_pyyaml", "PyYAML==6.0.1"), ("everest-testing_pip_deps_markupsafe", "MarkupSafe==2.1.3"), ("everest-testing_pip_deps_six", "six==1.16.0"), ("everest-testing_pip_deps_tomli", "tomli==2.0.1"), ("everest-testing_pip_deps_jinja2", "Jinja2==3.1.2"), ("everest-testing_pip_deps_referencing", "referencing==0.31.0"), ("everest-testing_pip_deps_rpds_py", "rpds-py==0.13.1"), ("everest-testing_pip_deps_stringcase", "stringcase==1.2.0"), ("everest-testing_pip_deps_pkgutil_resolve_name", "pkgutil_resolve_name>=1.3.10"), ("everest-testing_pip_deps_importlib_resources", "importlib_resources>=1.4.0"), ("everest-testing_pip_deps_zipp", "zipp>=1.0.0"), ("everest-testing_pip_deps_pyyaml", "pyyaml==6.0.1")]
_config = {"download_only": False, "enable_implicit_namespace_pkgs": False, "environment": {}, "envsubst": [], "extra_pip_args": [], "isolated": True, "pip_data_exclude": [], "python_interpreter": "python3", "quiet": True, "repo": "everest-testing_pip_deps", "repo_prefix": "everest-testing_pip_deps_", "timeout": 600}
_annotations = {}
def requirement(name):
return "@everest-testing_pip_deps//{}:{}".format(pip_utils.normalize_name(name), "pkg")
def whl_requirement(name):
return "@everest-testing_pip_deps//{}:{}".format(pip_utils.normalize_name(name), "whl")
def data_requirement(name):
return "@everest-testing_pip_deps//{}:{}".format(pip_utils.normalize_name(name), "data")
def dist_info_requirement(name):
return "@everest-testing_pip_deps//{}:{}".format(pip_utils.normalize_name(name), "dist_info")
def entry_point(pkg, script = None):
if not script:
script = pkg
return "@everest-testing_pip_deps_" + pip_utils.normalize_name(pkg) + "//:rules_python_wheel_entry_point_" + script
def _get_annotation(requirement):
# This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11`
# down to `setuptools`.
name = requirement.split(" ")[0].split("=")[0].split("[")[0]
return _annotations.get(name)
def install_deps(**whl_library_kwargs):
"""Repository rule macro. Install dependencies from `pip_parse`.
Args:
**whl_library_kwargs: Additional arguments which will flow to underlying
`whl_library` calls. See pip_repository.bzl for details.
"""
# Set up the requirement groups
all_requirement_groups = {}
requirement_group_mapping = {
requirement: group_name
for group_name, group_requirements in all_requirement_groups.items()
for requirement in group_requirements
}
group_repo = "everest-testing_pip_deps__groups"
group_library(
name = group_repo,
repo_prefix = "everest-testing_pip_deps_",
groups = all_requirement_groups,
)
# Install wheels which may be participants in a group
whl_config = dict(_config)
whl_config.update(whl_library_kwargs)
for name, requirement in _packages:
group_name = requirement_group_mapping.get(name.replace("everest-testing_pip_deps_", ""))
group_deps = all_requirement_groups.get(group_name, [])
whl_library(
name = name,
requirement = requirement,
group_name = group_name,
group_deps = group_deps,
annotation = _get_annotation(requirement),
**whl_config
)