Skip to content

Commit 258cf01

Browse files
committed
improve deduplication logic on windows
1 parent 7919ac7 commit 258cf01

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ducktools/pythonfinder/win32/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def get_python_installs(
3838
*,
3939
finder: DetailFinder | None = None
4040
) -> Iterator[PythonInstall]:
41-
listed_installs = set()
41+
listed_stdlibs = set()
42+
listed_bins = set()
4243

4344
finder = DetailFinder() if finder is None else finder
4445

@@ -48,6 +49,12 @@ def get_python_installs(
4849
get_pyenv_pythons(finder=finder),
4950
get_uv_pythons(finder=finder),
5051
):
51-
if py.executable not in listed_installs:
52+
# Compare by stdlib paths for uniqueness
53+
stdlib_path = py.paths.get("stdlib")
54+
if stdlib_path:
55+
if stdlib_path not in listed_stdlibs:
56+
yield py
57+
listed_stdlibs.add(stdlib_path)
58+
elif py.executable not in listed_bins:
5259
yield py
53-
listed_installs.add(py.executable)
60+
listed_bins.add(py.executable)

0 commit comments

Comments
 (0)