mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Better algorithm for find_all_versions
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+5
@@ -76,6 +76,11 @@ class Finder(object):
|
||||
|
||||
def find_all_python_versions(self, major=None, minor=None, patch=None, pre=None, dev=None, arch=None):
|
||||
version_sort = operator.attrgetter("as_python.version_sort")
|
||||
python_version_dict = getattr(self.system_path, 'python_version_dict')
|
||||
if python_version_dict:
|
||||
paths = [path for version in python_version_dict.values() for path in version]
|
||||
paths = sorted(paths, key=version_sort, reverse=True)
|
||||
return paths
|
||||
versions = self.system_path.find_all_python_versions(major=major, minor=minor, patch=patch, pre=pre, dev=dev, arch=arch)
|
||||
if not isinstance(versions, list):
|
||||
versions = [versions,]
|
||||
|
||||
Reference in New Issue
Block a user