@@ -686,19 +686,25 @@ def _build_link_map(entries):
686686 # Here we store venv paths by package
687687 # dict[str package, dict[str kind, list[str venv_path]]]
688688 pkg_map = {}
689+
689690 for entry in entries :
690691 kind = entry .kind
691692 kind_map = link_map .setdefault (kind , {})
692693
694+ # TODO @aignas 2025-05-31: explain where we use the version
695+ package = None
696+ if entry .package :
697+ package , _ , _version = entry .package .partition ("-" )
698+
693699 # If we detect that we are adding a dist-info for an already existing package
694700 # we need to pop all of the previous symlinks from the link_map
695- if entry .venv_path .endswith (".dist-info" ) and entry . package in pkg_map :
701+ if entry .venv_path .endswith (".dist-info" ) and package in pkg_map :
696702 # dist-info will come always first
697- for kind , dir_paths in pkg_map .pop (entry . package ).items ():
703+ for kind , dir_paths in pkg_map .pop (package ).items ():
698704 for dir_path in dir_paths :
699705 link_map [kind ].pop (dir_path )
700706
701- pkg_venv_paths = pkg_map .setdefault (entry . package , {}).setdefault (entry .kind , [])
707+ pkg_venv_paths = pkg_map .setdefault (package , {}).setdefault (entry .kind , [])
702708 pkg_venv_paths .append (entry .venv_path )
703709
704710 # We overwrite duplicates by design. The dependency closer to the
0 commit comments