remove pkg_resources from pip freeze

This commit is contained in:
Kay0u 2024-07-16 23:26:35 +02:00
parent 14312a9ec4
commit 73e0d6c271
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D

View file

@ -74,8 +74,9 @@ def _backup_pip_freeze_for_python_app_venvs():
venvs = _get_all_venvs("/opt/") + _get_all_venvs("/var/www/")
for venv in venvs:
# 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(
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"
)