aboutsummaryrefslogtreecommitdiff
path: root/python/pip_install/pip_repository_requirements_bzlmod.bzl.tmpl
blob: 2df60b0b526ce6ddac66544e8698f55cff4a3d22 (plain)
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
"""Starlark representation of locked requirements.

@generated by rules_python pip_parse repository rule
from %%REQUIREMENTS_LOCK%%.
"""

all_requirements = %%ALL_REQUIREMENTS%%

all_whl_requirements = %%ALL_WHL_REQUIREMENTS%%

all_data_requirements = %%ALL_DATA_REQUIREMENTS%%

def _clean_name(name):
    return name.replace("-", "_").replace(".", "_").lower()

def requirement(name):
    return "%%MACRO_TMPL%%".format(_clean_name(name), "pkg")

def whl_requirement(name):
    return "%%MACRO_TMPL%%".format(_clean_name(name), "whl")

def data_requirement(name):
    return "%%MACRO_TMPL%%".format(_clean_name(name), "data")

def dist_info_requirement(name):
    return "%%MACRO_TMPL%%".format(_clean_name(name), "dist_info")

def entry_point(pkg, script = None):
    """entry_point returns the target of the canonical label of the package entrypoints.
    """
    if not script:
        script = pkg
    return "@@%%NAME%%_{}//:rules_python_wheel_entry_point_{}".format(_clean_name(pkg), script)