mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[CI] Format code with Black
This commit is contained in:
parent
f443631292
commit
26665b231a
3 changed files with 32 additions and 8 deletions
|
@ -1721,7 +1721,9 @@ def _get_app_settings(app):
|
||||||
# App settings should never be empty, there should always be at least some standard, internal keys like id, install_time etc.
|
# App settings should never be empty, there should always be at least some standard, internal keys like id, install_time etc.
|
||||||
# Otherwise, this probably means that the app settings disappeared somehow...
|
# Otherwise, this probably means that the app settings disappeared somehow...
|
||||||
if not settings:
|
if not settings:
|
||||||
logger.error(f"It looks like settings.yml for {app} is empty ... This should not happen ...")
|
logger.error(
|
||||||
|
f"It looks like settings.yml for {app} is empty ... This should not happen ..."
|
||||||
|
)
|
||||||
logger.error(m18n.n("app_not_correctly_installed", app=app))
|
logger.error(m18n.n("app_not_correctly_installed", app=app))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,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
|
||||||
os.system(f"{venv}/bin/pip freeze > {venv}{VENV_REQUIREMENTS_SUFFIX} 2>/dev/null")
|
os.system(
|
||||||
|
f"{venv}/bin/pip freeze > {venv}{VENV_REQUIREMENTS_SUFFIX} 2>/dev/null"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MyMigration(Migration):
|
class MyMigration(Migration):
|
||||||
|
@ -201,18 +203,30 @@ class MyMigration(Migration):
|
||||||
# Another boring fix for the super annoying libc6-dev: Breaks libgcc-8-dev
|
# Another boring fix for the super annoying libc6-dev: Breaks libgcc-8-dev
|
||||||
# https://forum.yunohost.org/t/20617
|
# https://forum.yunohost.org/t/20617
|
||||||
#
|
#
|
||||||
if os.system("dpkg --list | grep '^ii' | grep -q ' libgcc-8-dev'") == 0 and os.system("LC_ALL=C apt policy libgcc-8-dev | grep Candidate | grep -q rpi") == 0:
|
if (
|
||||||
logger.info("Attempting to fix the build-essential / libc6-dev / libgcc-8-dev hell ...")
|
os.system("dpkg --list | grep '^ii' | grep -q ' libgcc-8-dev'") == 0
|
||||||
|
and os.system(
|
||||||
|
"LC_ALL=C apt policy libgcc-8-dev | grep Candidate | grep -q rpi"
|
||||||
|
)
|
||||||
|
== 0
|
||||||
|
):
|
||||||
|
logger.info(
|
||||||
|
"Attempting to fix the build-essential / libc6-dev / libgcc-8-dev hell ..."
|
||||||
|
)
|
||||||
os.system("cp /var/lib/dpkg/status /root/dpkg_status.bkp")
|
os.system("cp /var/lib/dpkg/status /root/dpkg_status.bkp")
|
||||||
# This removes the dependency to build-essential from $app-ynh-deps
|
# This removes the dependency to build-essential from $app-ynh-deps
|
||||||
os.system(
|
os.system(
|
||||||
"perl -i~ -0777 -pe 's/(Package: .*-ynh-deps\\n(.+:.+\\n)+Depends:.*)(build-essential, ?)(.*)/$1$4/g' /var/lib/dpkg/status"
|
"perl -i~ -0777 -pe 's/(Package: .*-ynh-deps\\n(.+:.+\\n)+Depends:.*)(build-essential, ?)(.*)/$1$4/g' /var/lib/dpkg/status"
|
||||||
)
|
)
|
||||||
self.apt_install("build-essential-") # Note the '-' suffix to mean that we actually want to remove the packages
|
self.apt_install(
|
||||||
|
"build-essential-"
|
||||||
|
) # Note the '-' suffix to mean that we actually want to remove the packages
|
||||||
os.system(
|
os.system(
|
||||||
"LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt autoremove --assume-yes"
|
"LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt autoremove --assume-yes"
|
||||||
)
|
)
|
||||||
self.apt_install("gcc-8- libgcc-8-dev-") # Note the '-' suffix to mean that we actually want to remove the packages
|
self.apt_install(
|
||||||
|
"gcc-8- libgcc-8-dev-"
|
||||||
|
) # Note the '-' suffix to mean that we actually want to remove the packages
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main upgrade
|
# Main upgrade
|
||||||
|
@ -380,7 +394,10 @@ class MyMigration(Migration):
|
||||||
raise YunohostError("migration_0021_not_enough_free_space")
|
raise YunohostError("migration_0021_not_enough_free_space")
|
||||||
|
|
||||||
if free_space_in_directory("/boot/") / (120**3) < 1.0:
|
if free_space_in_directory("/boot/") / (120**3) < 1.0:
|
||||||
raise YunohostError("/boot/ has less than 120MB available. This will probably trigger a crash during the upgrade because a new kernel needs to be installed. Please look for advice on the forum on how to remove old, unused kernels to free up some space in /boot/.", raw_msg=True)
|
raise YunohostError(
|
||||||
|
"/boot/ has less than 120MB available. This will probably trigger a crash during the upgrade because a new kernel needs to be installed. Please look for advice on the forum on how to remove old, unused kernels to free up some space in /boot/.",
|
||||||
|
raw_msg=True,
|
||||||
|
)
|
||||||
|
|
||||||
# Check system is up to date
|
# Check system is up to date
|
||||||
# (but we don't if 'bullseye' is already in the sources.list ...
|
# (but we don't if 'bullseye' is already in the sources.list ...
|
||||||
|
|
|
@ -20,7 +20,12 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
if os.system('grep -A10 "ynh-deps" /var/lib/dpkg/status | grep -E "Package:|Depends:" | grep -B1 postgresql') != 0:
|
if (
|
||||||
|
os.system(
|
||||||
|
'grep -A10 "ynh-deps" /var/lib/dpkg/status | grep -E "Package:|Depends:" | grep -B1 postgresql'
|
||||||
|
)
|
||||||
|
!= 0
|
||||||
|
):
|
||||||
logger.info("No YunoHost app seem to require postgresql... Skipping!")
|
logger.info("No YunoHost app seem to require postgresql... Skipping!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue