Skip to content

Commit 85d0152

Browse files
committed
Fix windows specific sort order quirks
Signed-off-by: Dan Ryan <dan@danryan.co>
1 parent f1bfee0 commit 85d0152

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pipenv/vendor/pythonfinder/models/python.py

Lines changed: 2 additions & 2 deletions
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):
@@ -392,7 +392,7 @@ def version_sort(self):
392392
postrelease. ``(0, 3, 7, 3, 2)`` represents a non-core python release, e.g. by
393393
a repackager of python like Continuum.
394394
"""
395-
company_sort = 1 if self.company == "PythonCore" else 0
395+
company_sort = 1 if (self.company and self.company == "PythonCore") else 0
396396
release_sort = 2
397397
if self.is_postrelease:
398398
release_sort = 3

pipenv/vendor/pythonfinder/pythonfinder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ def find_all_python_versions(
308308
)
309309
if not isinstance(versions, Iterable):
310310
versions = [versions]
311+
# This list has already been mostly sorted on windows, we don't need to reverse it again
311312
path_list = sorted(versions, key=version_sort, reverse=True)
312313
path_map = {} # type: Dict[str, PathEntry]
313314
for path in path_list:
@@ -317,4 +318,4 @@ def find_all_python_versions(
317318
resolved_path = path.path.absolute()
318319
if not path_map.get(resolved_path.as_posix()):
319320
path_map[resolved_path.as_posix()] = path
320-
return list(path_map.values())
321+
return path_list

0 commit comments

Comments
 (0)