mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Doc-strings and formatting
This commit is contained in:
parent
3fea05c4d6
commit
22fc36e16e
1 changed files with 28 additions and 12 deletions
|
@ -33,7 +33,16 @@ N_NEXT_YUNOHOST = 11
|
||||||
VENV_REQUIREMENTS_SUFFIX = "_req.txt"
|
VENV_REQUIREMENTS_SUFFIX = "_req.txt"
|
||||||
VENV_IGNORE = "ynh_migration_no_regen"
|
VENV_IGNORE = "ynh_migration_no_regen"
|
||||||
|
|
||||||
|
|
||||||
def _get_all_venvs(dir, level=0, maxlevel=3):
|
def _get_all_venvs(dir, level=0, maxlevel=3):
|
||||||
|
"""
|
||||||
|
Returns the list of all python virtual env directories recursively
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
dir - the directory to scan in
|
||||||
|
maxlevel - the depth of the recursion
|
||||||
|
level - do not edit this, used as an iterator
|
||||||
|
"""
|
||||||
# Using os functions instead of glob, because glob doesn't support hidden folders, and we need recursion with a fixed depth
|
# Using os functions instead of glob, because glob doesn't support hidden folders, and we need recursion with a fixed depth
|
||||||
result = []
|
result = []
|
||||||
for file in os.listdir(dir):
|
for file in os.listdir(dir):
|
||||||
|
@ -51,7 +60,11 @@ def _get_all_venvs(dir,level=0,maxlevel=3):
|
||||||
result += _get_all_venvs(path, level=level + 1)
|
result += _get_all_venvs(path, level=level + 1)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def _generate_requirements():
|
def _generate_requirements():
|
||||||
|
"""
|
||||||
|
Generate a requirements file for all python virtual env located inside /opt/ and /var/www/
|
||||||
|
"""
|
||||||
|
|
||||||
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:
|
||||||
|
@ -60,6 +73,9 @@ def _generate_requirements():
|
||||||
|
|
||||||
|
|
||||||
def _rebuild_venvs():
|
def _rebuild_venvs():
|
||||||
|
"""
|
||||||
|
After the update, recreate a python virtual env based on the previously generated requirements file
|
||||||
|
"""
|
||||||
|
|
||||||
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:
|
||||||
|
|
Loading…
Add table
Reference in a new issue