Skip to content

Commit 0e3264c

Browse files
committed
Fix windows specific sort order quirks
Signed-off-by: Dan Ryan <[email protected]>
1 parent f1bfee0 commit 0e3264c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pipenv/vendor/pythonfinder/models/python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class PythonVersion(object):
354354
architecture = attr.ib(default=None) # type: Optional[str]
355355
comes_from = attr.ib(default=None) # type: Optional[PathEntry]
356356
executable = attr.ib(default=None) # type: Optional[str]
357-
company = attr.ib(default="PythonCore") # type: Optional[str]
357+
company = attr.ib(default=None) # type: Optional[str]
358358
name = attr.ib(default=None, type=str)
359359

360360
def __getattribute__(self, key):

pipenv/vendor/pythonfinder/pythonfinder.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ def find_all_python_versions(
308308
)
309309
if not isinstance(versions, Iterable):
310310
versions = [versions]
311-
path_list = sorted(versions, key=version_sort, reverse=True)
311+
# This list has already been mostly sorted on windows, we don't need to reverse it again
312+
if os.name == "nt":
313+
path_list = sorted(versions, key=version_sort)
314+
else:
315+
path_list = sorted(versions, key=version_sort, reverse=True)
312316
path_map = {} # type: Dict[str, PathEntry]
313317
for path in path_list:
314318
try:
@@ -317,4 +321,4 @@ def find_all_python_versions(
317321
resolved_path = path.path.absolute()
318322
if not path_map.get(resolved_path.as_posix()):
319323
path_map[resolved_path.as_posix()] = path
320-
return list(path_map.values())
324+
return path_list

0 commit comments

Comments
 (0)