summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBernát Gábor <bgabor8@bloomberg.net>2020-02-25 10:44:42 +0000
committerGitHub <noreply@github.com>2020-02-25 10:44:42 +0000
commit7d8d2afddabbefe43643b0b926cc75227dba5aef (patch)
treeded5ec0b244f468c7040985666e6f95028c3fa2b /src
parentc794bc2ad65eb96e017492091c997f69d39f03c6 (diff)
downloadvirtualenv-7d8d2afddabbefe43643b0b926cc75227dba5aef.tar.gz
Accept python self-referencing python executables (#1664)
Accept these as if they were system executables, print a info about them referencing themselves. Resolves #1632. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Diffstat (limited to 'src')
-rw-r--r--src/virtualenv/discovery/py_info.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py
index 3ffe57e..64b91dc 100644
--- a/src/virtualenv/discovery/py_info.py
+++ b/src/virtualenv/discovery/py_info.py
@@ -314,13 +314,17 @@ class PythonInfo(object):
while target.system_executable is None:
prefix = target.real_prefix or target.base_prefix or target.prefix
if prefix in prefixes:
+ if len(prefixes) == 1:
+ # if we're linking back to ourselves accept ourselves with a WARNING
+ logging.info("%r links back to itself via prefixes", target)
+ target.system_executable = target.executable
+ break
for at, (p, t) in enumerate(prefixes.items(), start=1):
logging.error("%d: prefix=%s, info=%r", at, p, t)
logging.error("%d: prefix=%s, info=%r", len(prefixes) + 1, prefix, target)
raise RuntimeError("prefixes are causing a circle {}".format("|".join(prefixes.keys())))
prefixes[prefix] = target
target = target.discover_exe(prefix=prefix, exact=False)
-
if target.executable != target.system_executable:
target = cls.from_exe(target.system_executable)
target.executable = start_executable