blob: 5ed1e49cc2278e71068846e5a1c051e38b37ff87 [file] [log] [blame]
"""Starlark representation of locked requirements.
@generated by rules_python pip.parse bzlmod extension.
"""
all_requirements = %%ALL_REQUIREMENTS%%
all_whl_requirements_by_package = %%ALL_WHL_REQUIREMENTS_BY_PACKAGE%%
all_whl_requirements = all_whl_requirements_by_package.values()
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
fail("""Please replace this instance of entry_point with the following:
```
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
py_console_script_binary(
name = "{pkg}",
pkg = "@%%{pkg_label}",
script = "{script}",
)
```
""".format(
pkg = _clean_name(pkg),
pkg_label = "%%MACRO_TMPL%%".format(_clean_name(pkg), "pkg"),
script = script,
))