From eeabd9fa0dc45d3c5ee27ed555a864faf07e8b33 Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Wed, 10 Jul 2024 19:45:41 -0700 Subject: [PATCH] wip: factoring out build-phase loading repo-phase symbols --- python/private/pypi/deps.bzl | 6 ++--- python/private/pypi/pip_compile.bzl | 27 +++++++++---------- python/private/pypi/whl_installer/BUILD.bazel | 14 +++++----- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/python/private/pypi/deps.bzl b/python/private/pypi/deps.bzl index 81bef7aaab..3b4680b0ae 100644 --- a/python/private/pypi/deps.bzl +++ b/python/private/pypi/deps.bzl @@ -123,10 +123,10 @@ py_library( """ # Collate all the repository names so they can be easily consumed -all_requirements = [name for (name, _, _) in _RULE_DEPS] +##all_requirements = [name for (name, _, _) in _RULE_DEPS] -def requirement(pkg): - return Label("@pypi__" + pkg + "//:lib") +##def requirement(pkg): +## return Label("@pypi__" + pkg + "//:lib") def pypi_deps(): """ diff --git a/python/private/pypi/pip_compile.bzl b/python/private/pypi/pip_compile.bzl index 7389e72120..f284a00f68 100644 --- a/python/private/pypi/pip_compile.bzl +++ b/python/private/pypi/pip_compile.bzl @@ -20,7 +20,6 @@ make it possible to have multiple tools inside the `pypi` directory """ load("//python:defs.bzl", _py_binary = "py_binary", _py_test = "py_test") -load(":deps.bzl", "requirement") def pip_compile( name, @@ -115,19 +114,19 @@ def pip_compile( args.extend(extra_args) deps = [ - requirement("build"), - requirement("click"), - requirement("colorama"), - requirement("importlib_metadata"), - requirement("more_itertools"), - requirement("packaging"), - requirement("pep517"), - requirement("pip"), - requirement("pip_tools"), - requirement("pyproject_hooks"), - requirement("setuptools"), - requirement("tomli"), - requirement("zipp"), + Label("@pypi__build//:lib"), + Label("@pypi__click//:lib"), + Label("@pypi__colorama//:lib"), + Label("@pypi__importlib_metadata//:lib"), + Label("@pypi__more_itertools//:lib"), + Label("@pypi__packaging//:lib"), + Label("@pypi__pep517//:lib"), + Label("@pypi__pip//:lib"), + Label("@pypi__pip_tools//:lib"), + Label("@pypi__pyproject_hooks//:lib"), + Label("@pypi__setuptools//:lib"), + Label("@pypi__tomli//:lib"), + Label("@pypi__zipp//:lib"), Label("//python/runfiles:runfiles"), ] + extra_deps diff --git a/python/private/pypi/whl_installer/BUILD.bazel b/python/private/pypi/whl_installer/BUILD.bazel index 58231ceb04..fc9c0e62b2 100644 --- a/python/private/pypi/whl_installer/BUILD.bazel +++ b/python/private/pypi/whl_installer/BUILD.bazel @@ -1,5 +1,4 @@ load("//python:defs.bzl", "py_binary", "py_library") -load("//python/private/pypi:deps.bzl", "requirement") py_library( name = "lib", @@ -10,14 +9,13 @@ py_library( "wheel_installer.py", ], visibility = [ - "//tests:__subpackages__", - "//third_party/rules_pycross/pycross/private:__subpackages__", + "//:__subpackages__", ], deps = [ - requirement("installer"), - requirement("pip"), - requirement("packaging"), - requirement("setuptools"), + "@pypi__installer//:lib", + "@pypi__packaging//:lib", + "@pypi__pip//:lib", + "@pypi__setuptools//:lib", ], ) @@ -32,5 +30,5 @@ py_binary( filegroup( name = "distribution", srcs = glob(["*"]), - visibility = ["//python/private/pypi:__subpackages__"], + visibility = ["//:__subpackages__"], )