Merge pull request #1401 from YunoHost/ci-format-dev

[CI] Format code with Black
This commit is contained in:
Alexandre Aubin 2022-01-03 17:07:21 +01:00 committed by GitHub
commit bd8fe6d4db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 21 deletions

View file

@ -41,8 +41,8 @@ class MyMigration(Migration):
) # For some reason if we don't do this, iptables-legacy-save is empty ? ) # For some reason if we don't do this, iptables-legacy-save is empty ?
self.runcmd("iptables-legacy-save > %s" % self.backup_rules_ipv4) self.runcmd("iptables-legacy-save > %s" % self.backup_rules_ipv4)
assert ( assert (
os.path.exists(self.backup_rules_ipv4) and os.path.exists(self.backup_rules_ipv4)
os.stat(self.backup_rules_ipv4).st_size > 0 and os.stat(self.backup_rules_ipv4).st_size > 0
), "Uhoh backup of legacy ipv4 rules is empty !?" ), "Uhoh backup of legacy ipv4 rules is empty !?"
if self.do_ipv6 and not os.path.exists(self.backup_rules_ipv6): if self.do_ipv6 and not os.path.exists(self.backup_rules_ipv6):
self.runcmd( self.runcmd(
@ -50,8 +50,8 @@ class MyMigration(Migration):
) # For some reason if we don't do this, iptables-legacy-save is empty ? ) # For some reason if we don't do this, iptables-legacy-save is empty ?
self.runcmd("ip6tables-legacy-save > %s" % self.backup_rules_ipv6) self.runcmd("ip6tables-legacy-save > %s" % self.backup_rules_ipv6)
assert ( assert (
os.path.exists(self.backup_rules_ipv6) and os.path.exists(self.backup_rules_ipv6)
os.stat(self.backup_rules_ipv6).st_size > 0 and os.stat(self.backup_rules_ipv6).st_size > 0
), "Uhoh backup of legacy ipv6 rules is empty !?" ), "Uhoh backup of legacy ipv6 rules is empty !?"
# We inject the legacy rules (iptables-legacy) into the new iptable (just "iptables") # We inject the legacy rules (iptables-legacy) into the new iptable (just "iptables")

View file

@ -148,7 +148,31 @@ class MyMigration(Migration):
# Also hopefully by then we'll have manifestv2 (maybe) and will be able to use # Also hopefully by then we'll have manifestv2 (maybe) and will be able to use
# the apt resource mecanism to regenerate the *-ynh-deps virtual packages ;) # the apt resource mecanism to regenerate the *-ynh-deps virtual packages ;)
php73packages_suffixes = ['apcu', 'bcmath', 'bz2', 'dom', 'gmp', 'igbinary', 'imagick', 'imap', 'mbstring', 'memcached', 'mysqli', 'mysqlnd', 'pgsql', 'redis', 'simplexml', 'soap', 'sqlite3', 'ssh2', 'tidy', 'xml', 'xmlrpc', 'xsl', 'zip'] php73packages_suffixes = [
"apcu",
"bcmath",
"bz2",
"dom",
"gmp",
"igbinary",
"imagick",
"imap",
"mbstring",
"memcached",
"mysqli",
"mysqlnd",
"pgsql",
"redis",
"simplexml",
"soap",
"sqlite3",
"ssh2",
"tidy",
"xml",
"xmlrpc",
"xsl",
"zip",
]
cmd = f""" cmd = f"""
apt show '*-ynh-deps' 2>/dev/null apt show '*-ynh-deps' 2>/dev/null
@ -157,10 +181,23 @@ class MyMigration(Migration):
| sort | uniq | sort | uniq
| sed 's/php7.3/php7.4/g' | sed 's/php7.3/php7.4/g'
""" """
php74packages_to_install = ["php7.4-fpm", "php7.4-common", "php7.4-ldap", "php7.4-intl", "php7.4-mysql", "php7.4-gd", "php7.4-curl", "php-php-gettext"] php74packages_to_install = [
php74packages_to_install += [f.strip() for f in check_output(cmd).split("\n") if f.strip()] "php7.4-fpm",
"php7.4-common",
"php7.4-ldap",
"php7.4-intl",
"php7.4-mysql",
"php7.4-gd",
"php7.4-curl",
"php-php-gettext",
]
php74packages_to_install += [
f.strip() for f in check_output(cmd).split("\n") if f.strip()
]
self.apt_install("{' '.join(php74packages_to_install)} -o Dpkg::Options::='--force-confmiss'") self.apt_install(
"{' '.join(php74packages_to_install)} -o Dpkg::Options::='--force-confmiss'"
)
# Remove legacy postgresql service record added by helpers, # Remove legacy postgresql service record added by helpers,
# will now be dynamically handled by the core in bullseye # will now be dynamically handled by the core in bullseye

View file

@ -517,9 +517,7 @@ def domain_cert_install(
): ):
from yunohost.certificate import certificate_install from yunohost.certificate import certificate_install
return certificate_install( return certificate_install(domain_list, force, no_checks, self_signed, staging)
domain_list, force, no_checks, self_signed, staging
)
def domain_cert_renew( def domain_cert_renew(
@ -527,9 +525,7 @@ def domain_cert_renew(
): ):
from yunohost.certificate import certificate_renew from yunohost.certificate import certificate_renew
return certificate_renew( return certificate_renew(domain_list, force, no_checks, email, staging)
domain_list, force, no_checks, email, staging
)
def domain_dns_conf(domain): def domain_dns_conf(domain):

View file

@ -244,9 +244,7 @@ def tools_postinstall(
# and inform the user that we could not contact the dyndns host server. # and inform the user that we could not contact the dyndns host server.
except Exception: except Exception:
logger.warning( logger.warning(
m18n.n( m18n.n("dyndns_provider_unreachable", provider="dyndns.yunohost.org")
"dyndns_provider_unreachable", provider="dyndns.yunohost.org"
)
) )
if available: if available:

View file

@ -1265,9 +1265,7 @@ def user_group_remove(groupname, usernames, force=False, sync_perm=True):
def user_permission_list(short=False, full=False, apps=[]): def user_permission_list(short=False, full=False, apps=[]):
from yunohost.permission import user_permission_list from yunohost.permission import user_permission_list
return user_permission_list( return user_permission_list(short, full, absolute_urls=True, apps=apps)
short, full, absolute_urls=True, apps=apps
)
def user_permission_update(permission, label=None, show_tile=None, sync_perm=True): def user_permission_update(permission, label=None, show_tile=None, sync_perm=True):