mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix pythonfinder bug unnesting python versions
Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
+2
-2
@@ -4,7 +4,7 @@ import abc
|
||||
import operator
|
||||
import six
|
||||
from itertools import chain
|
||||
from ..utils import KNOWN_EXTS
|
||||
from ..utils import KNOWN_EXTS, unnest
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
@@ -88,7 +88,7 @@ class BasePath(object):
|
||||
if self.is_python and version_matcher(self.as_python):
|
||||
return self
|
||||
return
|
||||
finder = ((child, child.as_python) for child in chain(*filter(None, self.pythons.values())) if child.as_python)
|
||||
finder = ((child, child.as_python) for child in unnest(self.pythons.values()) if child.as_python)
|
||||
py_filter = filter(
|
||||
None, filter(lambda child: version_matcher(child[1]), finder)
|
||||
)
|
||||
|
||||
Vendored
+7
@@ -8,6 +8,7 @@ import subprocess
|
||||
import sys
|
||||
from fnmatch import fnmatch
|
||||
from .exceptions import InvalidPythonVersion
|
||||
from itertools import chain
|
||||
|
||||
try:
|
||||
from pathlib import Path
|
||||
@@ -137,3 +138,9 @@ def fs_str(string):
|
||||
|
||||
|
||||
_fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
|
||||
|
||||
|
||||
def unnest(item):
|
||||
if isinstance(next((i for i in item), None), (list, tuple)):
|
||||
return chain(*filter(None, item))
|
||||
return chain(filter(None, item))
|
||||
|
||||
Reference in New Issue
Block a user