Skip to content

Commit

Permalink
Windows fix
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Jul 16, 2018
1 parent 0e3af57 commit ff985cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
16 changes: 4 additions & 12 deletions pipenv/vendor/pythonfinder/models/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,13 @@ def find_all_python_versions(self, major=None, minor=None, patch=None, pre=None,
None, filter(lambda c: version_matcher(c), self.version_list)
)
version_sort = operator.attrgetter("version_sort")
for c in sorted(py_filter, key=version_sort, reverse=True):
yield c.comes_from
return [c.comes_from for c in sorted(py_filter, key=version_sort, reverse=True)]

def find_python_version(self, major=None, minor=None, patch=None, pre=None, dev=None):
# version_matcher = operator.methodcaller(
# "matches", major=major, minor=minor, patch=patch, pre=pre, dev=dev
# )
# py_filter = filter(
# None, filter(lambda c: version_matcher(c), self.version_list)
# )
# version_sort = operator.attrgetter("version_sort")
return next(
self.find_all_python_versions(
return next((
v for v in self.find_all_python_versions(
major=major, minor=minor, patch=patch, pre=pre, dev=dev
), None
)), None
)

@versions.default
Expand Down
5 changes: 3 additions & 2 deletions pipenv/vendor/pythonfinder/pythonfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def find_python_version(self, major, minor=None, patch=None, pre=None, dev=None)

def find_all_python_versions(self, major=None, minor=None, patch=None, pre=None, dev=None):
version_sort = operator.attrgetter("as_python.version_sort")
versions = self.system_path.find_all_python_versions(major=major, minor=minor, patch=patch, pre=pre, dev=dev)
versions = []
versions.extend([p for p in self.system_path.find_all_python_versions(major=major, minor=minor, patch=patch, pre=pre, dev=dev)])
if os.name == 'nt':
windows_versions = self.windows_finder.find_all_python_versions(major=major, minor=minor, patch=patch, pre=pre, dev=dev)
versions = list(versions) + list(windows_versions)
versions = versions + list(windows_versions)
return sorted(versions, key=version_sort, reverse=True)

0 comments on commit ff985cc

Please sign in to comment.