mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix windows specific sort order quirks
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+2
-2
@@ -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):
|
||||
@@ -392,7 +392,7 @@ class PythonVersion(object):
|
||||
postrelease. ``(0, 3, 7, 3, 2)`` represents a non-core python release, e.g. by
|
||||
a repackager of python like Continuum.
|
||||
"""
|
||||
company_sort = 1 if self.company == "PythonCore" else 0
|
||||
company_sort = 1 if (self.company and self.company == "PythonCore") else 0
|
||||
release_sort = 2
|
||||
if self.is_postrelease:
|
||||
release_sort = 3
|
||||
|
||||
+2
-1
@@ -308,6 +308,7 @@ class Finder(object):
|
||||
)
|
||||
if not isinstance(versions, Iterable):
|
||||
versions = [versions]
|
||||
# This list has already been mostly sorted on windows, we don't need to reverse it again
|
||||
path_list = sorted(versions, key=version_sort, reverse=True)
|
||||
path_map = {} # type: Dict[str, PathEntry]
|
||||
for path in path_list:
|
||||
@@ -317,4 +318,4 @@ class Finder(object):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user