To make sure sys.path is set correctly (and the appropriate sitecustomize.py is loaded if present) when a virtualenv is activated, the program name needs to start with the virtualenv path. At startup, prybar-python3 looks for the $VIRTUAL_ENV environment variable and, if present, sets the program name to $VIRTUAL_ENV/bin/prybar-python3.
Testing this path requires adding machinery to the prybar tests. I don't want to take the time to add that machinery now, but I have tested this branch in polygott and it does indeed set the correct path.
An embedded python interpreter computes
sys.path
based on the prefix of the interpreter name: https://docs.python.org/3/c-api/init.html#c.Py_SetProgramNameTo make sure
sys.path
is set correctly (and the appropriatesitecustomize.py
is loaded if present) when a virtualenv is activated, the program name needs to start with the virtualenv path. At startup, prybar-python3 looks for the $VIRTUAL_ENV environment variable and, if present, sets the program name to $VIRTUAL_ENV/bin/prybar-python3.Testing this path requires adding machinery to the prybar tests. I don't want to take the time to add that machinery now, but I have tested this branch in polygott and it does indeed set the correct path.