-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequirements.bzl
More file actions
executable file
路53 lines (40 loc) 路 1.84 KB
/
Copy pathrequirements.bzl
File metadata and controls
executable file
路53 lines (40 loc) 路 1.84 KB
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
"""Starlark representation of locked requirements.
@generated by rules_python pip_parse repository rule
from //requirements:base-requirements.lock.txt
"""
load("@python310//:defs.bzl", "interpreter")
load("@rules_python//python/pip_install:pip_repository.bzl", "whl_library")
all_requirements = []
all_whl_requirements = []
_packages = []
_config = {"download_only": False, "enable_implicit_namespace_pkgs": False, "environment": {}, "extra_pip_args": [], "isolated": True, "pip_data_exclude": [], "python_interpreter": "python3", "python_interpreter_target": interpreter, "quiet": True, "repo": "ecosystem", "repo_prefix": "ecosystem_", "timeout": 600}
_annotations = {}
def _clean_name(name):
return name.replace("-", "_").replace(".", "_").lower()
def requirement(name):
return "@ecosystem_" + _clean_name(name) + "//:pkg"
def whl_requirement(name):
return "@ecosystem_" + _clean_name(name) + "//:whl"
def data_requirement(name):
return "@ecosystem_" + _clean_name(name) + "//:data"
def dist_info_requirement(name):
return "@ecosystem_" + _clean_name(name) + "//:dist_info"
def entry_point(pkg, script = None):
if not script:
script = pkg
return "@ecosystem_" + _clean_name(pkg) + "//:rules_python_wheel_entry_point_" + script
def _get_annotation(requirement):
# This expects to parse `setuptools==58.2.0 --hash=sha256:2551203ae6955b9876741a26ab3e767bb3242dafe86a32a749ea0d78b6792f11`
# down wo `setuptools`.
name = requirement.split(" ")[0].split("=")[0]
return _annotations.get(name)
def install_deps(**whl_library_kwargs):
whl_config = dict(_config)
whl_config.update(whl_library_kwargs)
for name, requirement in _packages:
whl_library(
name = name,
requirement = requirement,
annotation = _get_annotation(requirement),
**whl_config
)