Merge pull request #1912 from YunoHost/fix-venv-pre-bookworm

remove pkg_resources from pip freeze
This commit is contained in:
Alexandre Aubin 2024-07-17 00:56:26 +02:00 committed by GitHub
commit 845a14bfe1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -74,8 +74,9 @@ def _backup_pip_freeze_for_python_app_venvs():
venvs = _get_all_venvs("/opt/") + _get_all_venvs("/var/www/") venvs = _get_all_venvs("/opt/") + _get_all_venvs("/var/www/")
for venv in venvs: for venv in venvs:
# Generate a requirements file from venv # Generate a requirements file from venv
# Remove pkg resources from the freeze to avoid an error during the python venv https://stackoverflow.com/a/40167445
os.system( os.system(
f"{venv}/bin/pip freeze > {venv}{VENV_REQUIREMENTS_SUFFIX} 2>/dev/null" f"{venv}/bin/pip freeze | grep -E -v 'pkg(-|_)resources==' > {venv}{VENV_REQUIREMENTS_SUFFIX} 2>/dev/null"
) )