Skip to content

Commit

Permalink
Fix windows specific sort order quirks
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Jul 6, 2019
1 parent f1bfee0 commit 0e3264c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pipenv/vendor/pythonfinder/models/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class PythonVersion(object):
architecture = attr.ib(default=None) # type: Optional[str]
comes_from = attr.ib(default=None) # type: Optional[PathEntry]
executable = attr.ib(default=None) # type: Optional[str]
company = attr.ib(default="PythonCore") # type: Optional[str]
company = attr.ib(default=None) # type: Optional[str]
name = attr.ib(default=None, type=str)

def __getattribute__(self, key):
Expand Down
8 changes: 6 additions & 2 deletions pipenv/vendor/pythonfinder/pythonfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,11 @@ def find_all_python_versions(
)
if not isinstance(versions, Iterable):
versions = [versions]
path_list = sorted(versions, key=version_sort, reverse=True)
# This list has already been mostly sorted on windows, we don't need to reverse it again
if os.name == "nt":
path_list = sorted(versions, key=version_sort)
else:
path_list = sorted(versions, key=version_sort, reverse=True)
path_map = {} # type: Dict[str, PathEntry]
for path in path_list:
try:
Expand All @@ -317,4 +321,4 @@ def find_all_python_versions(
resolved_path = path.path.absolute()
if not path_map.get(resolved_path.as_posix()):
path_map[resolved_path.as_posix()] = path
return list(path_map.values())
return path_list

0 comments on commit 0e3264c

Please sign in to comment.