diff options
| author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-02-25 10:44:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-25 10:44:42 +0000 |
| commit | 7d8d2afddabbefe43643b0b926cc75227dba5aef (patch) | |
| tree | ded5ec0b244f468c7040985666e6f95028c3fa2b | |
| parent | c794bc2ad65eb96e017492091c997f69d39f03c6 (diff) | |
| download | virtualenv-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>
| -rw-r--r-- | .dockerignore | 1 | ||||
| -rw-r--r-- | docs/changelog/1632.bugfix.rst | 2 | ||||
| -rw-r--r-- | src/virtualenv/discovery/py_info.py | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..172bf57 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.tox diff --git a/docs/changelog/1632.bugfix.rst b/docs/changelog/1632.bugfix.rst new file mode 100644 index 0000000..ce53419 --- /dev/null +++ b/docs/changelog/1632.bugfix.rst @@ -0,0 +1,2 @@ +Fix circular prefix reference with single elements (accept these as if they were system executables, print a info about +them referencing themselves) - by :user:`gaborbernat`. 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 |
