Skip to content

Commit 3e48c89

Browse files
committed
fix(pypi): Handle case where dep is in extras multiple times
1 parent 144984c commit 3e48c89

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

python/private/pypi/pep508_deps.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def deps(
8181
deps_select = {
8282
d: markers
8383
for d, markers in sorted(deps_select.items())
84+
if d not in deps
8485
},
8586
)
8687

tests/pypi/pep508/deps_tests.bzl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,24 @@ def test_all_markers_are_added(env):
161161

162162
_tests.append(test_all_markers_are_added)
163163

164+
def test_markers_with_extra(env):
165+
requires_dist = [
166+
"bar",
167+
'baz!=1.56.0; sys_platform == "darwin" and extra == "client"',
168+
'baz; extra == "client"',
169+
]
170+
171+
got = deps(
172+
"foo",
173+
extras = ["client"],
174+
requires_dist = requires_dist,
175+
)
176+
177+
env.expect.that_collection(got.deps).contains_exactly(["bar", "baz"])
178+
env.expect.that_dict(got.deps_select).contains_exactly({})
179+
180+
_tests.append(test_markers_with_extra)
181+
164182
def deps_test_suite(name): # buildifier: disable=function-docstring
165183
test_suite(
166184
name = name,

0 commit comments

Comments
 (0)