Add support for a $sitedir/venv directory and activate it when found.
Review Request #13056 — Created May 19, 2023 and updated
As part of an effort to move toward encouraging virtualenv-based
management of Review Board installs, this change updates our WSGI
entrypoint and our auto-generated configurations to detect and
sanity-check a virtualenv setup and activate it if available.
reviewboard/wsgi.pynow looks to see if we have a
directory. If it exists, and we're not already in a virtualenv, it will
make sure the right files are present and then activate it. If anything
is missing, a
RuntimeErrorwill be raised with instructions, helping
admins sort out the issue.
Validation checks for the presence of an
python -m venv) and a
binary matching the currently-executing Python version.
Environment variables are built from the new state, ensuring
subprocesses will see the correct versions of binaries and packages.
This also adds a
$PATH, giving us a place to put
p4without placing them in system directories.
Tested with both a global Python and a virtualenv-backed install.
Verified that the
venvdirectory was present for a virtualenv-backed
install, and that its environment was properly used in a default Apache,
uWSGI, and Gunicorn setup.
Tested pruning some of the virtualenv dir to hit the WSGI error checks.
Verified the resulting errors.
Instead of "recreate" I think we should explicitly say they should delete the old one and create a new one …
reviewboard/wsgi.py (Diff revision 1)
Instead of "recreate" I think we should explicitly say they should delete the old one and create a new one with