mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
venv rebuild: moar logic fixes
This commit is contained in:
parent
5f265d0c16
commit
a4fca12ebf
2 changed files with 4 additions and 8 deletions
|
@ -505,7 +505,7 @@
|
||||||
"migration_0023_postgresql_13_not_installed": "PostgreSQL 11 is installed, but not PostgreSQL 13!? Something weird might have happened on your system :(...",
|
"migration_0023_postgresql_13_not_installed": "PostgreSQL 11 is installed, but not PostgreSQL 13!? Something weird might have happened on your system :(...",
|
||||||
"migration_0024_rebuild_python_venv_broken_app": "Skipping {app} because virtualenv can't easily be rebuilt for this app. Instead, you should fix the situation by forcing the upgrade of this app using `yunohost app upgrade --force {app}`.",
|
"migration_0024_rebuild_python_venv_broken_app": "Skipping {app} because virtualenv can't easily be rebuilt for this app. Instead, you should fix the situation by forcing the upgrade of this app using `yunohost app upgrade --force {app}`.",
|
||||||
"migration_0024_rebuild_python_venv_disclaimer_base": "Following the upgrade to Debian Bullseye, some Python applications needs to be partially rebuilt to get converted to the new Python version shipped in Debian (in technical terms: what's called the 'virtualenv' needs to be recreated). In the meantime, those Python applications may not work. YunoHost can attempt to rebuild the virtualenv for some of those, as detailed below. For other apps, or if the rebuild attempt fails, you will need to manually force an upgrade for those apps.",
|
"migration_0024_rebuild_python_venv_disclaimer_base": "Following the upgrade to Debian Bullseye, some Python applications needs to be partially rebuilt to get converted to the new Python version shipped in Debian (in technical terms: what's called the 'virtualenv' needs to be recreated). In the meantime, those Python applications may not work. YunoHost can attempt to rebuild the virtualenv for some of those, as detailed below. For other apps, or if the rebuild attempt fails, you will need to manually force an upgrade for those apps.",
|
||||||
"migration_0024_rebuild_python_venv_disclaimer_rebuild": "Rebuilding the virtualenv will be attempted for the following apps (NB: the operation may take some time!): {rebuid_apps}",
|
"migration_0024_rebuild_python_venv_disclaimer_rebuild": "Rebuilding the virtualenv will be attempted for the following apps (NB: the operation may take some time!): {rebuild_apps}",
|
||||||
"migration_0024_rebuild_python_venv_disclaimer_ignored": "Virtualenvs can't be rebuilt automatically for those apps. You need to force an upgrade for those, which can be done from the command line with: `yunohost app upgrade -f APP`: {ignored_apps}",
|
"migration_0024_rebuild_python_venv_disclaimer_ignored": "Virtualenvs can't be rebuilt automatically for those apps. You need to force an upgrade for those, which can be done from the command line with: `yunohost app upgrade -f APP`: {ignored_apps}",
|
||||||
"migration_0024_rebuild_python_venv_in_progress": "Now attempting to rebuild python virtualenv for `{app}`",
|
"migration_0024_rebuild_python_venv_in_progress": "Now attempting to rebuild python virtualenv for `{app}`",
|
||||||
"migration_0024_rebuild_python_venv_failed": "Failed to rebuild the python virtual env for {app}. The app may not work as long as this is not resolved. You should fix the situation by forcing the upgrade of this app using `yunohost app upgrade --force {app}`.",
|
"migration_0024_rebuild_python_venv_failed": "Failed to rebuild the python virtual env for {app}. The app may not work as long as this is not resolved. You should fix the situation by forcing the upgrade of this app using `yunohost app upgrade --force {app}`.",
|
||||||
|
|
|
@ -37,11 +37,9 @@ def _get_all_venvs(dir, level=0, maxlevel=3):
|
||||||
path = os.path.join(dir, file)
|
path = os.path.join(dir, file)
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
activatepath = os.path.join(path, "bin", "activate")
|
activatepath = os.path.join(path, "bin", "activate")
|
||||||
if os.path.isfile(activatepath):
|
if os.path.isfile(activatepath) and os.path.isfile(path + VENV_REQUIREMENTS_SUFFIX):
|
||||||
content = read_file(activatepath)
|
result.append(path)
|
||||||
if ("VIRTUAL_ENV" in content) and ("PYTHONHOME" in content):
|
continue
|
||||||
result.append(path)
|
|
||||||
continue
|
|
||||||
if level < maxlevel:
|
if level < maxlevel:
|
||||||
result += _get_all_venvs(path, level=level + 1)
|
result += _get_all_venvs(path, level=level + 1)
|
||||||
return result
|
return result
|
||||||
|
@ -122,8 +120,6 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
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:
|
||||||
if not os.path.isfile(venv + VENV_REQUIREMENTS_SUFFIX):
|
|
||||||
continue
|
|
||||||
|
|
||||||
app_corresponding_to_venv = extract_app_from_venv_path(venv)
|
app_corresponding_to_venv = extract_app_from_venv_path(venv)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue