Propagate dir structure change to scripts etc

This commit is contained in:
Alexandre Aubin 2021-11-10 18:25:37 +01:00
parent 5de9e4fe6a
commit 05f25fa85f
38 changed files with 113 additions and 111 deletions

View file

@ -1,2 +1,2 @@
[report]
omit=src/yunohost/tests/*,src/yunohost/vendor/*,/usr/lib/moulinette/yunohost/*
omit=src/tests/*,src/vendor/*,/usr/lib/moulinette/yunohost/*

4
.gitignore vendored
View file

@ -31,7 +31,7 @@ pip-log.txt
.mr.developer.cfg
# moulinette lib
src/yunohost/locales
src/locales
# Test
src/yunohost/tests/apps
src/tests/apps

View file

@ -11,7 +11,7 @@
- *install_debs
cache:
paths:
- src/yunohost/tests/apps
- src/tests/apps
key: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
needs:
- job: build-yunohost
@ -36,7 +36,7 @@ full-tests:
- *install_debs
- yunohost tools postinstall -d domain.tld -p the_password --ignore-dyndns --force-diskspace
script:
- python3 -m pytest --cov=yunohost tests/ src/yunohost/tests/ data/hooks/diagnosis/ --junitxml=report.xml
- python3 -m pytest --cov=yunohost tests/ src/tests/ src/diagnosis/ --junitxml=report.xml
- cd tests
- bash test_helpers.sh
needs:
@ -57,8 +57,8 @@ test-i18n-keys:
only:
changes:
- locales/en.json
- src/yunohost/*.py
- data/hooks/diagnosis/*.py
- src/*.py
- src/diagnosis/*.py
test-translation-format-consistency:
extends: .test-stage
@ -74,7 +74,7 @@ test-actionmap:
- python3 -m pytest tests/test_actionmap.py
only:
changes:
- data/actionsmap/*.yml
- share/actionsmap.yml
test-helpers:
extends: .test-stage
@ -83,126 +83,126 @@ test-helpers:
- bash test_helpers.sh
only:
changes:
- data/helpers.d/*
- helpers/*
test-domains:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_domains.py
- python3 -m pytest src/tests/test_domains.py
only:
changes:
- src/yunohost/domain.py
- src/domain.py
test-dns:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_dns.py
- python3 -m pytest src/tests/test_dns.py
only:
changes:
- src/yunohost/dns.py
- src/yunohost/utils/dns.py
- src/dns.py
- src/utils/dns.py
test-apps:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_apps.py
- python3 -m pytest src/tests/test_apps.py
only:
changes:
- src/yunohost/app.py
- src/app.py
test-appscatalog:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_app_catalog.py
- python3 -m pytest src/tests/test_app_catalog.py
only:
changes:
- src/yunohost/app_calalog.py
- src/app_calalog.py
test-appurl:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_appurl.py
- python3 -m pytest src/tests/test_appurl.py
only:
changes:
- src/yunohost/app.py
- src/app.py
test-questions:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_questions.py
- python3 -m pytest src/tests/test_questions.py
only:
changes:
- src/yunohost/utils/config.py
- src/utils/config.py
test-app-config:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_app_config.py
- python3 -m pytest src/tests/test_app_config.py
only:
changes:
- src/yunohost/app.py
- src/yunohost/utils/config.py
- src/app.py
- src/utils/config.py
test-changeurl:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_changeurl.py
- python3 -m pytest src/tests/test_changeurl.py
only:
changes:
- src/yunohost/app.py
- src/app.py
test-backuprestore:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_backuprestore.py
- python3 -m pytest src/tests/test_backuprestore.py
only:
changes:
- src/yunohost/backup.py
- src/backup.py
test-permission:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_permission.py
- python3 -m pytest src/tests/test_permission.py
only:
changes:
- src/yunohost/permission.py
- src/permission.py
test-settings:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_settings.py
- python3 -m pytest src/tests/test_settings.py
only:
changes:
- src/yunohost/settings.py
- src/settings.py
test-user-group:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_user-group.py
- python3 -m pytest src/tests/test_user-group.py
only:
changes:
- src/yunohost/user.py
- src/user.py
test-regenconf:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_regenconf.py
- python3 -m pytest src/tests/test_regenconf.py
only:
changes:
- src/yunohost/regenconf.py
- src/regenconf.py
test-service:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_service.py
- python3 -m pytest src/tests/test_service.py
only:
changes:
- src/yunohost/service.py
- src/service.py
test-ldapauth:
extends: .test-stage
script:
- python3 -m pytest src/yunohost/tests/test_ldapauth.py
- python3 -m pytest src/tests/test_ldapauth.py
only:
changes:
- src/yunohost/authenticators/*.py
- src/authenticators/*.py

View file

@ -23,7 +23,7 @@ ssl_cert = </etc/yunohost/certs/{{ main_domain }}/crt.pem
ssl_key = </etc/yunohost/certs/{{ main_domain }}/key.pem
# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
ssl_dh = </usr/share/yunohost/other/ffdhe2048.pem
ssl_dh = </usr/share/yunohost/ffdhe2048.pem
# intermediate configuration
ssl_min_protocol = TLSv1.2

View file

@ -18,7 +18,7 @@ ssl_prefer_server_ciphers off;
# Pre-defined FFDHE group (RFC 7919)
# From https://ssl-config.mozilla.org/ffdhe2048.txt
# https://security.stackexchange.com/a/149818
ssl_dhparam /usr/share/yunohost/other/ffdhe2048.pem;
ssl_dhparam /usr/share/yunohost/ffdhe2048.pem;
{% endif %}

View file

@ -36,7 +36,7 @@ smtpd_tls_mandatory_ciphers = medium
# curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam.pem
# not actually 1024 bits, this applies to all DHE >= 1024 bits
smtpd_tls_dh1024_param_file = /usr/share/yunohost/other/ffdhe2048.pem
smtpd_tls_dh1024_param_file = /usr/share/yunohost/ffdhe2048.pem
tls_medium_cipherlist = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
{% else %}

9
debian/install vendored
View file

@ -1,7 +1,10 @@
bin/* /usr/bin/
data/* /usr/share/yunohost/
data/bash-completion.d/yunohost /etc/bash_completion.d/
share/* /usr/share/yunohost/
hooks/* /usr/share/yunohost/hooks/
helpers/* /usr/share/yunohost/helpers.d/
conf/* /usr/share/yunohost/conf/
doc/yunohost.8.gz /usr/share/man/man8/
doc/bash-completion.sh /etc/bash_completion.d/yunohost
lib/metronome/modules/* /usr/lib/metronome/modules/
locales/* /usr/lib/moulinette/yunohost/locales/
src/yunohost /usr/lib/moulinette
src/ /usr/lib/moulinette/yunohost

2
debian/rules vendored
View file

@ -6,7 +6,7 @@
override_dh_auto_build:
# Generate bash completion file
python3 data/actionsmap/yunohost_completion.py
python3 doc/generate_bash_completion.py
python3 doc/generate_manpages.py --gzip --output doc/yunohost.8.gz
override_dh_installinit:

View file

@ -12,9 +12,8 @@ import os
import yaml
THIS_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
ACTIONSMAP_FILE = THIS_SCRIPT_DIR + "/yunohost.yml"
os.system(f"mkdir {THIS_SCRIPT_DIR}/../bash-completion.d")
BASH_COMPLETION_FILE = THIS_SCRIPT_DIR + "/../bash-completion.d/yunohost"
ACTIONSMAP_FILE = THIS_SCRIPT_DIR + "/../share/actionsmap.yml"
BASH_COMPLETION_FILE = THIS_SCRIPT_DIR + "/bash-completion.sh"
def get_dict_actions(OPTION_SUBTREE, category):

View file

@ -217,7 +217,7 @@ def malformed_error(line_number):
def main():
helper_files = sorted(glob.glob("../data/helpers.d/*"))
helper_files = sorted(glob.glob("../helpers/*"))
helpers = []
for helper_file in helper_files:

View file

@ -22,7 +22,7 @@ template = Template(open(os.path.join(base_path, "manpage.template")).read())
THIS_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
ACTIONSMAP_FILE = os.path.join(THIS_SCRIPT_DIR, "../data/actionsmap/yunohost.yml")
ACTIONSMAP_FILE = os.path.join(THIS_SCRIPT_DIR, "../share/actionsmap.yml")
def ordered_yaml_load(stream):

View file

@ -52,7 +52,7 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/{{
{{ h.details }}
{%- endif %}
[Dude, show me the code!](https://github.com/YunoHost/yunohost/blob/{{ current_commit }}/data/helpers.d/{{ category }}#L{{ h.line + 1 }})
[Dude, show me the code!](https://github.com/YunoHost/yunohost/blob/{{ current_commit }}/helpers/{{ category }}#L{{ h.line + 1 }})
[/details]
----------------
{% endfor %}

View file

@ -8,7 +8,7 @@ do_init_regen() {
exit 1
fi
cd /usr/share/yunohost/templates/yunohost
cd /usr/share/yunohost/conf/yunohost
[[ -d /etc/yunohost ]] || mkdir -p /etc/yunohost
@ -71,7 +71,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/yunohost
cd /usr/share/yunohost/conf/yunohost
mkdir -p $pending_dir/etc/systemd/system
mkdir -p $pending_dir/etc/cron.d/

View file

@ -6,7 +6,7 @@ ssl_dir="/usr/share/yunohost/yunohost-config/ssl/yunoCA"
ynh_ca="/etc/yunohost/certs/yunohost.org/ca.pem"
ynh_crt="/etc/yunohost/certs/yunohost.org/crt.pem"
ynh_key="/etc/yunohost/certs/yunohost.org/key.pem"
openssl_conf="/usr/share/yunohost/templates/ssl/openssl.cnf"
openssl_conf="/usr/share/yunohost/conf/ssl/openssl.cnf"
regen_local_ca() {
@ -26,7 +26,7 @@ regen_local_ca() {
RANDFILE=.rnd openssl rand -hex 19 >serial
rm -f index.txt
touch index.txt
cp /usr/share/yunohost/templates/ssl/openssl.cnf openssl.ca.cnf
cp /usr/share/yunohost/conf/ssl/openssl.cnf openssl.ca.cnf
sed -i "s/yunohost.org/${domain}/g" openssl.ca.cnf
openssl req -x509 \
-new \
@ -57,7 +57,7 @@ do_init_regen() {
# Make sure this conf exists
mkdir -p ${ssl_dir}
cp /usr/share/yunohost/templates/ssl/openssl.cnf ${ssl_dir}/openssl.ca.cnf
cp /usr/share/yunohost/conf/ssl/openssl.cnf ${ssl_dir}/openssl.ca.cnf
# create default certificates
if [[ ! -f "$ynh_ca" ]]; then
@ -99,7 +99,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/ssl
cd /usr/share/yunohost/conf/ssl
install -D -m 644 openssl.cnf "${pending_dir}/${ssl_dir}/openssl.cnf"
}

View file

@ -7,7 +7,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/ssh
cd /usr/share/yunohost/conf/ssh
# do not listen to IPv6 if unavailable
[[ -f /proc/net/if_inet6 ]] && ipv6_enabled=true || ipv6_enabled=false

View file

@ -4,8 +4,8 @@ set -e
tmp_backup_dir_file="/root/slapd-backup-dir.txt"
config="/usr/share/yunohost/templates/slapd/config.ldif"
db_init="/usr/share/yunohost/templates/slapd/db_init.ldif"
config="/usr/share/yunohost/conf/slapd/config.ldif"
db_init="/usr/share/yunohost/conf/slapd/db_init.ldif"
do_init_regen() {
if [[ $EUID -ne 0 ]]; then
@ -109,7 +109,7 @@ do_pre_regen() {
schema_dir="${ldap_dir}/schema"
mkdir -p "$ldap_dir" "$schema_dir"
cd /usr/share/yunohost/templates/slapd
cd /usr/share/yunohost/conf/slapd
# copy configuration files
cp -a ldap.conf "$ldap_dir"

View file

@ -10,7 +10,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/nslcd
cd /usr/share/yunohost/conf/nslcd
install -D -m 644 nslcd.conf "${pending_dir}/etc/nslcd.conf"
}

View file

@ -5,7 +5,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/metronome
cd /usr/share/yunohost/conf/metronome
# create directories for pending conf
metronome_dir="${pending_dir}/etc/metronome"

View file

@ -10,7 +10,7 @@ do_init_regen() {
exit 1
fi
cd /usr/share/yunohost/templates/nginx
cd /usr/share/yunohost/conf/nginx
nginx_dir="/etc/nginx"
nginx_conf_dir="${nginx_dir}/conf.d"
@ -47,7 +47,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/nginx
cd /usr/share/yunohost/conf/nginx
nginx_dir="${pending_dir}/etc/nginx"
nginx_conf_dir="${nginx_dir}/conf.d"

View file

@ -7,7 +7,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/postfix
cd /usr/share/yunohost/conf/postfix
postfix_dir="${pending_dir}/etc/postfix"
mkdir -p "$postfix_dir"

View file

@ -7,7 +7,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/dovecot
cd /usr/share/yunohost/conf/dovecot
dovecot_dir="${pending_dir}/etc/dovecot"
mkdir -p "${dovecot_dir}/global_script"

View file

@ -5,7 +5,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/rspamd
cd /usr/share/yunohost/conf/rspamd
install -D -m 644 metrics.local.conf \
"${pending_dir}/etc/rspamd/local.d/metrics.conf"

View file

@ -6,7 +6,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/mysql
cd /usr/share/yunohost/conf/mysql
# Nothing to do
}

View file

@ -29,7 +29,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir="$1"
cd /usr/share/yunohost/templates/mdns
cd /usr/share/yunohost/conf/mdns
mkdir -p ${pending_dir}/etc/systemd/system/
cp yunomdns.service ${pending_dir}/etc/systemd/system/

View file

@ -6,7 +6,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/dnsmasq
cd /usr/share/yunohost/conf/dnsmasq
# create directory for pending conf
dnsmasq_dir="${pending_dir}/etc/dnsmasq.d"

View file

@ -10,7 +10,7 @@ do_init_regen() {
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/nsswitch
cd /usr/share/yunohost/conf/nsswitch
install -D -m 644 nsswitch.conf "${pending_dir}/etc/nsswitch.conf"
}

View file

@ -7,7 +7,7 @@ set -e
do_pre_regen() {
pending_dir=$1
cd /usr/share/yunohost/templates/fail2ban
cd /usr/share/yunohost/conf/fail2ban
fail2ban_dir="${pending_dir}/etc/fail2ban"
mkdir -p "${fail2ban_dir}/filter.d"

View file

@ -152,7 +152,7 @@ class IPDiagnoser(Diagnoser):
# We use the resolver file as a list of well-known, trustable (ie not google ;)) IPs that we can ping
resolver_file = (
"/usr/share/yunohost/templates/dnsmasq/plain/resolv.dnsmasq.conf"
"/usr/share/yunohost/conf/dnsmasq/plain/resolv.dnsmasq.conf"
)
resolvers = [
r.split(" ")[1]

View file

@ -14,7 +14,7 @@ from yunohost.domain import _get_maindomain, domain_list
from yunohost.settings import settings_get
from yunohost.utils.dns import dig
DEFAULT_DNS_BLACKLIST = "/usr/share/yunohost/other/dnsbl_list.yml"
DEFAULT_DNS_BLACKLIST = "/usr/share/yunohost/dnsbl_list.yml"
class MailDiagnoser(Diagnoser):

View file

@ -50,7 +50,7 @@ from yunohost.hook import hook_callback
logger = getActionLogger("yunohost.domain")
DOMAIN_REGISTRAR_LIST_PATH = "/usr/share/yunohost/other/registrar_list.toml"
DOMAIN_REGISTRAR_LIST_PATH = "/usr/share/yunohost/registrar_list.toml"
def domain_dns_suggest(domain):

View file

@ -44,7 +44,7 @@ from yunohost.log import is_unit_operation
logger = getActionLogger("yunohost.domain")
DOMAIN_CONFIG_PATH = "/usr/share/yunohost/other/config_domain.toml"
DOMAIN_CONFIG_PATH = "/usr/share/yunohost/config_domain.toml"
DOMAIN_SETTINGS_DIR = "/etc/yunohost/domains"
# Lazy dev caching to avoid re-query ldap every time we need the domain list

View file

@ -48,7 +48,7 @@ from moulinette.utils.filesystem import (
MOULINETTE_LOCK = "/var/run/moulinette_yunohost.lock"
SERVICES_CONF = "/etc/yunohost/services.yml"
SERVICES_CONF_BASE = "/usr/share/yunohost/templates/yunohost/services.yml"
SERVICES_CONF_BASE = "/usr/share/yunohost/conf/yunohost/services.yml"
logger = getActionLogger("yunohost.service")

View file

@ -192,7 +192,7 @@ def evaluate_simple_js_expression(expr, context={}):
class ConfigPanel:
entity_type = "config"
save_path_tpl: Union[str, None] = None
config_path_tpl = "/usr/share/yunohost/other/config_{entity_type}.toml"
config_path_tpl = "/usr/share/yunohost/config_{entity_type}.toml"
save_mode = "full"
@classmethod

View file

@ -36,7 +36,7 @@ SMALL_PWD_LIST = [
"rpi",
]
MOST_USED_PASSWORDS = "/usr/share/yunohost/other/password/100000-most-used.txt"
MOST_USED_PASSWORDS = "/usr/share/yunohost/password/100000-most-used-passwords.txt"
# Length, digits, lowers, uppers, others
STRENGTH_LEVELS = [

View file

@ -24,11 +24,11 @@ def find_expected_string_keys():
p3 = re.compile(r"YunohostValidationError\(\n*\s*[\'\"](\w+)[\'\"]")
p4 = re.compile(r"# i18n: [\'\"]?(\w+)[\'\"]?")
python_files = glob.glob("src/yunohost/*.py")
python_files.extend(glob.glob("src/yunohost/utils/*.py"))
python_files.extend(glob.glob("src/yunohost/data_migrations/*.py"))
python_files.extend(glob.glob("src/yunohost/authenticators/*.py"))
python_files.extend(glob.glob("data/hooks/diagnosis/*.py"))
python_files = glob.glob("src/*.py")
python_files.extend(glob.glob("src/utils/*.py"))
python_files.extend(glob.glob("src/data_migrations/*.py"))
python_files.extend(glob.glob("src/authenticators/*.py"))
python_files.extend(glob.glob("src/diagnosis/*.py"))
python_files.append("bin/yunohost")
for python_file in python_files:
@ -51,7 +51,7 @@ def find_expected_string_keys():
# For each diagnosis, try to find strings like "diagnosis_stuff_foo" (c.f. diagnosis summaries)
# Also we expect to have "diagnosis_description_<name>" for each diagnosis
p3 = re.compile(r"[\"\'](diagnosis_[a-z]+_\w+)[\"\']")
for python_file in glob.glob("data/hooks/diagnosis/*.py"):
for python_file in glob.glob("src/diagnosis/*.py"):
content = open(python_file).read()
for m in p3.findall(content):
if m.endswith("_"):
@ -63,14 +63,14 @@ def find_expected_string_keys():
]
# For each migration, expect to find "migration_description_<name>"
for path in glob.glob("src/yunohost/data_migrations/*.py"):
for path in glob.glob("src/data_migrations/*.py"):
if "__init__" in path:
continue
yield "migration_description_" + os.path.basename(path)[:-3]
# For each default service, expect to find "service_description_<name>"
for service, info in yaml.safe_load(
open("data/templates/yunohost/services.yml")
open("conf/yunohost/services.yml")
).items():
if info is None:
continue
@ -79,7 +79,7 @@ def find_expected_string_keys():
# For all unit operations, expect to find "log_<name>"
# A unit operation is created either using the @is_unit_operation decorator
# or using OperationLogger(
cmd = "grep -hr '@is_unit_operation' src/yunohost/ -A3 2>/dev/null | grep '^def' | sed -E 's@^def (\\w+)\\(.*@\\1@g'"
cmd = "grep -hr '@is_unit_operation' src/ -A3 2>/dev/null | grep '^def' | sed -E 's@^def (\\w+)\\(.*@\\1@g'"
for funcname in (
subprocess.check_output(cmd, shell=True).decode("utf-8").strip().split("\n")
):
@ -94,14 +94,14 @@ def find_expected_string_keys():
# Global settings descriptions
# Will be on a line like : ("service.ssh.allow_deprecated_dsa_hostkey", {"type": "bool", ...
p5 = re.compile(r" \(\n*\s*[\"\'](\w[\w\.]+)[\"\'],")
content = open("src/yunohost/settings.py").read()
content = open("src/settings.py").read()
for m in (
"global_settings_setting_" + s.replace(".", "_") for s in p5.findall(content)
):
yield m
# Keys for the actionmap ...
for category in yaml.safe_load(open("data/actionsmap/yunohost.yml")).values():
for category in yaml.safe_load(open("share/actionsmap.yml")).values():
if "actions" not in category.keys():
continue
for action in category["actions"].values():

View file

@ -2,4 +2,4 @@ import yaml
def test_yaml_syntax():
yaml.safe_load(open("data/actionsmap/yunohost.yml"))
yaml.safe_load(open("share/actionsmap.yml"))

View file

@ -25,11 +25,11 @@ def find_expected_string_keys():
p3 = re.compile(r"YunohostValidationError\(\n*\s*[\'\"](\w+)[\'\"]")
p4 = re.compile(r"# i18n: [\'\"]?(\w+)[\'\"]?")
python_files = glob.glob("src/yunohost/*.py")
python_files.extend(glob.glob("src/yunohost/utils/*.py"))
python_files.extend(glob.glob("src/yunohost/data_migrations/*.py"))
python_files.extend(glob.glob("src/yunohost/authenticators/*.py"))
python_files.extend(glob.glob("data/hooks/diagnosis/*.py"))
python_files = glob.glob("src/*.py")
python_files.extend(glob.glob("src/utils/*.py"))
python_files.extend(glob.glob("src/data_migrations/*.py"))
python_files.extend(glob.glob("src/authenticators/*.py"))
python_files.extend(glob.glob("src/diagnosis/*.py"))
python_files.append("bin/yunohost")
for python_file in python_files:
@ -52,7 +52,7 @@ def find_expected_string_keys():
# For each diagnosis, try to find strings like "diagnosis_stuff_foo" (c.f. diagnosis summaries)
# Also we expect to have "diagnosis_description_<name>" for each diagnosis
p3 = re.compile(r"[\"\'](diagnosis_[a-z]+_\w+)[\"\']")
for python_file in glob.glob("data/hooks/diagnosis/*.py"):
for python_file in glob.glob("src/diagnosis/*.py"):
content = open(python_file).read()
for m in p3.findall(content):
if m.endswith("_"):
@ -64,14 +64,14 @@ def find_expected_string_keys():
]
# For each migration, expect to find "migration_description_<name>"
for path in glob.glob("src/yunohost/data_migrations/*.py"):
for path in glob.glob("src/data_migrations/*.py"):
if "__init__" in path:
continue
yield "migration_description_" + os.path.basename(path)[:-3]
# For each default service, expect to find "service_description_<name>"
for service, info in yaml.safe_load(
open("data/templates/yunohost/services.yml")
open("conf/yunohost/services.yml")
).items():
if info is None:
continue
@ -80,7 +80,7 @@ def find_expected_string_keys():
# For all unit operations, expect to find "log_<name>"
# A unit operation is created either using the @is_unit_operation decorator
# or using OperationLogger(
cmd = "grep -hr '@is_unit_operation' src/yunohost/ -A3 2>/dev/null | grep '^def' | sed -E 's@^def (\\w+)\\(.*@\\1@g'"
cmd = "grep -hr '@is_unit_operation' src/ -A3 2>/dev/null | grep '^def' | sed -E 's@^def (\\w+)\\(.*@\\1@g'"
for funcname in (
subprocess.check_output(cmd, shell=True).decode("utf-8").strip().split("\n")
):
@ -95,14 +95,14 @@ def find_expected_string_keys():
# Global settings descriptions
# Will be on a line like : ("service.ssh.allow_deprecated_dsa_hostkey", {"type": "bool", ...
p5 = re.compile(r" \(\n*\s*[\"\'](\w[\w\.]+)[\"\'],")
content = open("src/yunohost/settings.py").read()
content = open("src/settings.py").read()
for m in (
"global_settings_setting_" + s.replace(".", "_") for s in p5.findall(content)
):
yield m
# Keys for the actionmap ...
for category in yaml.safe_load(open("data/actionsmap/yunohost.yml")).values():
for category in yaml.safe_load(open("src/actionsmap.yml")).values():
if "actions" not in category.keys():
continue
for action in category["actions"].values():
@ -130,13 +130,13 @@ def find_expected_string_keys():
yield "backup_applying_method_%s" % method
yield "backup_method_%s_finished" % method
registrars = toml.load(open("data/other/registrar_list.toml"))
registrars = toml.load(open("share/registrar_list.toml"))
supported_registrars = ["ovh", "gandi", "godaddy"]
for registrar in supported_registrars:
for key in registrars[registrar].keys():
yield f"domain_config_{key}"
domain_config = toml.load(open("data/other/config_domain.toml"))
domain_config = toml.load(open("share/config_domain.toml"))
for panel in domain_config.values():
if not isinstance(panel, dict):
continue

View file

@ -8,8 +8,8 @@ deps =
py39-black-{run,check}: black
py39-mypy: mypy >= 0.900
commands =
py39-lint: flake8 src doc data tests --ignore E402,E501,E203,W503 --exclude src/yunohost/vendor
py39-invalidcode: flake8 src data --exclude src/yunohost/tests,src/yunohost/vendor --select F,E722,W605
py39-lint: flake8 src doc data tests --ignore E402,E501,E203,W503 --exclude src/vendor
py39-invalidcode: flake8 src data --exclude src/tests,src/vendor --select F,E722,W605
py39-black-check: black --check --diff src doc data tests
py39-black-run: black src doc data tests
py39-mypy: mypy --ignore-missing-import --install-types --non-interactive --follow-imports silent src/yunohost/ --exclude (acme_tiny|data_migrations)
py39-mypy: mypy --ignore-missing-import --install-types --non-interactive --follow-imports silent src/ --exclude (acme_tiny|data_migrations)