summaryrefslogtreecommitdiff
path: root/src/virtualenv/discovery
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2020-02-11 14:24:02 +0000
committerGitHub <noreply@github.com>2020-02-11 14:24:02 +0000
commitb577bfd31309ef20d3c2ee226f4e4d03f81fd893 (patch)
tree994c1031e555876f1863cdeedaabbd59deca0d8f /src/virtualenv/discovery
parent38460574703c3f0047474a35b292520da8afa402 (diff)
downloadvirtualenv-b577bfd31309ef20d3c2ee226f4e4d03f81fd893.tar.gz
on exe discovery ignore incorrect interpreters, also try in the… (#1573)
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/virtualenv/discovery')
-rw-r--r--src/virtualenv/discovery/py_info.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py
index eb15341..211778c 100644
--- a/src/virtualenv/discovery/py_info.py
+++ b/src/virtualenv/discovery/py_info.py
@@ -338,7 +338,9 @@ class PythonInfo(object):
for name in possible_names:
exe_path = os.path.join(folder, name)
if os.path.exists(exe_path):
- info = self.from_exe(exe_path, resolve_to_host=False)
+ info = self.from_exe(exe_path, resolve_to_host=False, raise_on_error=False)
+ if info is None: # ignore if for some reason we can't query
+ continue
for item in ["implementation", "architecture", "version_info"]:
found = getattr(info, item)
searched = getattr(self, item)
@@ -411,6 +413,9 @@ class PythonInfo(object):
# or at root level
candidate_folder[inside_folder] = None
+ if self.executable.startswith(self.prefix):
+ binary_within = os.path.relpath(os.path.dirname(self.executable), self.prefix)
+ candidate_folder[os.path.join(inside_folder, binary_within)] = None
return list(candidate_folder.keys())