Skip to content

Commit 825757b

Browse files
committed
cleanup bzlmod codebase after pipstar enabling
1 parent f1338dd commit 825757b

File tree

2 files changed

+5
-70
lines changed

2 files changed

+5
-70
lines changed

python/private/pypi/extension.bzl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ load("@rules_python_internal//:rules_python_config.bzl", rp_config = "config")
2121
load("//python/private:auth.bzl", "AUTH_ATTRS")
2222
load("//python/private:normalize_name.bzl", "normalize_name")
2323
load("//python/private:repo_utils.bzl", "repo_utils")
24-
load(":evaluate_markers.bzl", EVALUATE_MARKERS_SRCS = "SRCS")
2524
load(":hub_builder.bzl", "hub_builder")
2625
load(":hub_repository.bzl", "hub_repository", "whl_config_settings_to_json")
2726
load(":parse_whl_name.bzl", "parse_whl_name")
@@ -672,13 +671,6 @@ EXPERIMENTAL: this may be removed without notice.
672671
doc = """\
673672
A dict of labels to wheel names that is typically generated by the whl_modifications.
674673
The labels are JSON config files describing the modifications.
675-
""",
676-
),
677-
"_evaluate_markers_srcs": attr.label_list(
678-
default = EVALUATE_MARKERS_SRCS,
679-
doc = """\
680-
The list of labels to use as SRCS for the marker evaluation code. This ensures that the
681-
code will be re-evaluated when any of files in the default changes.
682674
""",
683675
),
684676
}, **ATTRS)

python/private/pypi/hub_builder.bzl

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ load("//python/private:normalize_name.bzl", "normalize_name")
55
load("//python/private:version.bzl", "version")
66
load("//python/private:version_label.bzl", "version_label")
77
load(":attrs.bzl", "use_isolated")
8-
load(":evaluate_markers.bzl", "evaluate_markers_py", evaluate_markers_star = "evaluate_markers")
8+
load(":evaluate_markers.bzl", "evaluate_markers")
99
load(":parse_requirements.bzl", "parse_requirements")
1010
load(":pep508_env.bzl", "env")
1111
load(":pep508_evaluate.bzl", "evaluate")
@@ -175,8 +175,6 @@ def _add_whl_library(self, *, python_version, whl, repo):
175175
# disallow building from sdist.
176176
return
177177

178-
platforms = self._platforms[python_version]
179-
180178
# TODO @aignas 2025-06-29: we should not need the version in the repo_name if
181179
# we are using pipstar and we are downloading the wheel using the downloader
182180
repo_name = "{}_{}_{}".format(self.name, version_label(python_version), repo.repo_name)
@@ -188,17 +186,6 @@ def _add_whl_library(self, *, python_version, whl, repo):
188186
))
189187
self._whl_libraries[repo_name] = repo.args
190188

191-
if not self._config.enable_pipstar and "experimental_target_platforms" in repo.args:
192-
self._whl_libraries[repo_name] |= {
193-
"experimental_target_platforms": sorted({
194-
# TODO @aignas 2025-07-07: this should be solved in a better way
195-
platforms[candidate].triple.partition("_")[-1]: None
196-
for p in repo.args["experimental_target_platforms"]
197-
for candidate in platforms
198-
if candidate.endswith(p)
199-
}),
200-
}
201-
202189
mapping = self._whl_map.setdefault(whl.name, {})
203190
if repo.config_setting in mapping and mapping[repo.config_setting] != repo_name:
204191
fail(
@@ -329,41 +316,9 @@ def _evaluate_markers(self, pip_attr):
329316
if self._evaluate_markers_fn:
330317
return self._evaluate_markers_fn
331318

332-
if self._config.enable_pipstar:
333-
return lambda _, requirements: evaluate_markers_star(
334-
requirements = requirements,
335-
platforms = self._platforms[pip_attr.python_version],
336-
)
337-
338-
interpreter = _detect_interpreter(self, pip_attr)
339-
340-
# NOTE @aignas 2024-08-02: , we will execute any interpreter that we find either
341-
# in the PATH or if specified as a label. We will configure the env
342-
# markers when evaluating the requirement lines based on the output
343-
# from the `requirements_files_by_platform` which should have something
344-
# similar to:
345-
# {
346-
# "//:requirements.txt": ["cp311_linux_x86_64", ...]
347-
# }
348-
#
349-
# We know the target python versions that we need to evaluate the
350-
# markers for and thus we don't need to use multiple python interpreter
351-
# instances to perform this manipulation. This function should be executed
352-
# only once by the underlying code to minimize the overhead needed to
353-
# spin up a Python interpreter.
354-
return lambda module_ctx, requirements: evaluate_markers_py(
355-
module_ctx,
356-
requirements = {
357-
k: {
358-
p: self._platforms[pip_attr.python_version][p].triple
359-
for p in plats
360-
}
361-
for k, plats in requirements.items()
362-
},
363-
python_interpreter = interpreter.path,
364-
python_interpreter_target = interpreter.target,
365-
srcs = pip_attr._evaluate_markers_srcs,
366-
logger = self._logger,
319+
return lambda _, requirements: evaluate_markers(
320+
requirements = requirements,
321+
platforms = self._platforms[pip_attr.python_version],
367322
)
368323

369324
def _create_whl_repos(
@@ -435,7 +390,6 @@ def _create_whl_repos(
435390
auth_patterns = self._config.auth_patterns or pip_attr.auth_patterns,
436391
python_version = _major_minor_version(pip_attr.python_version),
437392
is_multiple_versions = whl.is_multiple_versions,
438-
enable_pipstar = self._config.enable_pipstar,
439393
)
440394
_add_whl_library(
441395
self,
@@ -463,8 +417,6 @@ def _common_args(self, module_ctx, *, pip_attr):
463417
python_interpreter = interpreter.path,
464418
python_interpreter_target = interpreter.target,
465419
)
466-
if not self._config.enable_pipstar:
467-
maybe_args["experimental_target_platforms"] = pip_attr.experimental_target_platforms
468420

469421
whl_library_args.update({k: v for k, v in maybe_args.items() if v})
470422
maybe_args_with_default = dict(
@@ -512,8 +464,7 @@ def _whl_repo(
512464
netrc,
513465
auth_patterns,
514466
python_version,
515-
use_downloader,
516-
enable_pipstar = False):
467+
use_downloader):
517468
args = dict(whl_library_args)
518469
args["requirement"] = src.requirement_line
519470
is_whl = src.filename.endswith(".whl")
@@ -556,14 +507,6 @@ def _whl_repo(
556507
args["urls"] = [src.url]
557508
args["sha256"] = src.sha256
558509
args["filename"] = src.filename
559-
if not enable_pipstar:
560-
args["experimental_target_platforms"] = [
561-
# Get rid of the version for the target platforms because we are
562-
# passing the interpreter any way. Ideally we should search of ways
563-
# how to pass the target platforms through the hub repo.
564-
p.partition("_")[2]
565-
for p in src.target_platforms
566-
]
567510

568511
return struct(
569512
repo_name = whl_repo_name(src.filename, src.sha256),

0 commit comments

Comments
 (0)