Skip to content

Commit 5b7fb40

Browse files
committed
fix logic
1 parent 16f835a commit 5b7fb40

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

python/private/py_executable.bzl

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -687,25 +687,17 @@ def _build_link_map(entries):
687687
version_by_pkg = {}
688688

689689
for entry in entries:
690-
# We overwrite duplicates by design. The dependency closer to the
691-
# binary gets precedence due to the topological ordering.
692-
693-
if entry.package and version_by_pkg.get(entry.package) != entry.version:
694-
# If we detect that we are adding a different package version, clear the
695-
# previously added values.
696-
version_by_pkg[entry.package] = entry.version
697-
698-
# Overwrite any existing values because this is closer to the terminal
699-
# node
700-
pkg_link_map.pop(entry.package, None)
701-
702690
link_map = pkg_link_map.setdefault(entry.package, {})
703691
kind_map = link_map.setdefault(entry.kind, {})
704692

705-
if entry.venv_path in kind_map:
693+
if version_by_pkg.setdefault(entry.package, entry.version) != entry.version:
706694
# We ignore duplicates by design. The dependency closer to the
707695
# binary gets precedence due to the topological ordering.
708696
continue
697+
elif entry.venv_path in kind_map:
698+
# NOTE @aignas 2025-06-05: This branch should be hit only for first party
699+
# packages, maybe we should error here?
700+
continue
709701
else:
710702
kind_map[entry.venv_path] = entry.link_to_path
711703

0 commit comments

Comments
 (0)