OSDN Git Service

mkvenv: add nested venv workaround
authorJohn Snow <jsnow@redhat.com>
Thu, 11 May 2023 03:54:13 +0000 (23:54 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 18 May 2023 06:53:51 +0000 (08:53 +0200)
commitdee01b827ffc26577217697074052b8b7f4770dc
tree825bb4cc98afbf98c9a83e58d6a682224706e658
parenta9dbde71da553fe0b132ffac6d1a0de16892a90d
mkvenv: add nested venv workaround

Python virtual environments do not typically nest; they may inherit from
the top-level system packages or not at all.

For our purposes, it would be convenient to emulate "nested" virtual
environments to allow callers of the configure script to install
specific versions of python utilities in order to test build system
features, utility version compatibility, etc.

While it is possible to install packages into the system environment
(say, by using the --user flag), it's nicer to install test packages
into a totally isolated environment instead.

As detailed in https://www.qemu.org/2023/03/24/python/, Emulate a nested
venv environment by using .pth files installed into the site-packages
folder that points to the parent environment when appropriate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20230511035435.734312-6-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
python/scripts/mkvenv.py