Skip to content

Commit 4bc73f3

Browse files
committed
refactor logging and naming
1 parent 60fb1e9 commit 4bc73f3

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

python/private/pypi/parse_requirements.bzl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ def parse_requirements(
115115

116116
# This may call to Python, so execute it early (before calling to the
117117
# internet below) and ensure that we call it only once.
118-
env_marker_target_platforms = evaluate_markers(ctx, reqs_with_env_markers)
118+
resolved_marker_platforms = evaluate_markers(ctx, reqs_with_env_markers)
119119
logger.trace(lambda: "Evaluated env markers from:\n{}\n\nTo:\n{}".format(
120120
reqs_with_env_markers,
121-
env_marker_target_platforms,
121+
resolved_marker_platforms,
122122
))
123123

124124
requirements_by_platform = {}
125-
for target_platform, parse_results in requirements.items():
125+
for plat, parse_results in requirements.items():
126126
# Replicate a surprising behavior that WORKSPACE builds allowed:
127127
# Defining a repo with the same name multiple times, but only the last
128128
# definition is respected.
@@ -143,16 +143,12 @@ def parse_requirements(
143143
req_line = entry[1]
144144
req = requirement(req_line)
145145

146-
if req.marker:
147-
plats = env_marker_target_platforms.get(req_line, [])
148-
if not plats:
149-
continue
150-
elif target_platform not in plats:
151-
continue
146+
if req.marker and plat not in resolved_marker_platforms.get(req_line, []):
147+
continue
152148

153149
requirements_dict[req.name] = entry
154150

155-
extra_pip_args = options[target_platform]
151+
extra_pip_args = options[plat]
156152

157153
for distribution, requirement_line in requirements_dict.values():
158154
for_whl = requirements_by_platform.setdefault(
@@ -170,7 +166,7 @@ def parse_requirements(
170166
extra_pip_args = extra_pip_args,
171167
),
172168
)
173-
for_req.target_platforms.append(target_platform)
169+
for_req.target_platforms.append(plat)
174170

175171
index_urls = {}
176172
if get_index_urls:

tests/pypi/parse_requirements/parse_requirements_tests.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,6 @@ def _test_get_index_urls_different_versions(env):
696696
),
697697
},
698698
),
699-
debug = True,
700699
)
701700

702701
env.expect.that_collection(got).contains_exactly([
@@ -770,7 +769,6 @@ def _test_get_index_urls_single_py_version(env):
770769
),
771770
},
772771
),
773-
debug = True,
774772
)
775773

776774
env.expect.that_collection(got).contains_exactly([

0 commit comments

Comments
 (0)