Comment 4 for bug 1962791

Revision history for this message
Anders Kaseorg (andersk) wrote :

sysconfig-debian-schemes.patch uses an incorrect test for a virtual environment:

if 'real_prefix' in sys.__dict__ or 'VIRTUAL_ENV' in os.environ:

Both sys.real_prefix and VIRTUAL_ENV are only set by virtualenv, not venv, and then only when the virtualenv is activated by VENV_ROOT/bin/activate, not when VENV_ROOT/bin/python is launched directly by its path.

This patch corrects the test to

if sys.base_prefix != sys.prefix:

which works on Python ≥ 3.3.

(Also submitted to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006707.)