mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
The `@pypi_<name>` references are deprecated and their repo names are an implementation detail of how an underlying library is downloaded. The modern, supported, way is to go through the hub (`@pypi`). This also makes the code compatible with both workspace and bzlmod. PiperOrigin-RevId: 812915387
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Hermetic Python initialization. Consult the WORKSPACE on how to use it."""
|
|
|
|
load("@python_version_repo//:py_version.bzl", "REQUIREMENTS_WITH_LOCAL_WHEELS")
|
|
load("@rules_python//python:pip.bzl", "package_annotation", "pip_parse")
|
|
load(
|
|
"//third_party/py:python_init_toolchains.bzl",
|
|
"get_toolchain_name_per_python_version",
|
|
)
|
|
|
|
def python_init_pip():
|
|
numpy_annotations = {
|
|
"numpy": package_annotation(
|
|
additive_build_content = """\
|
|
cc_library(
|
|
name = "numpy_headers_2",
|
|
hdrs = glob(["site-packages/numpy/_core/include/**/*.h"]),
|
|
strip_include_prefix="site-packages/numpy/_core/include/",
|
|
)
|
|
cc_library(
|
|
name = "numpy_headers_1",
|
|
hdrs = glob(["site-packages/numpy/core/include/**/*.h"]),
|
|
strip_include_prefix="site-packages/numpy/core/include/",
|
|
)
|
|
cc_library(
|
|
name = "numpy_headers",
|
|
deps = [":numpy_headers_2", ":numpy_headers_1"],
|
|
)
|
|
""",
|
|
),
|
|
}
|
|
|
|
pip_parse(
|
|
name = "pypi",
|
|
annotations = numpy_annotations,
|
|
python_interpreter_target = "@{}_host//:python".format(
|
|
get_toolchain_name_per_python_version("python"),
|
|
),
|
|
extra_hub_aliases = {
|
|
"numpy": ["numpy_headers"],
|
|
},
|
|
requirements_lock = REQUIREMENTS_WITH_LOCAL_WHEELS,
|
|
)
|