Fix for creating a new python virtualenv inside a virtualenv/venv

This fixes a bug similar to that reported in issues #2525 #2503 and #2299.
This commit is contained in:
Marcelo Duarte 2022-09-25 14:55:52 -03:00 committed by GitHub
parent b1de3338ef
commit 4ca70e1394
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,6 +211,9 @@ def install_environment(
envdir = prefix.path(helpers.environment_dir(ENVIRONMENT_DIR, version))
venv_cmd = [sys.executable, '-mvirtualenv', envdir]
python = norm_version(version)
# fix for creating a virtualenv inside a virtualenv/venv
if python is None and sys.executable != os.readlink(sys.executable):
python = os.readlink(sys.executable)
if python is not None:
venv_cmd.extend(('-p', python))
install_cmd = ('python', '-mpip', 'install', '.', *additional_dependencies)