Also check _common.sh

This commit is contained in:
Alexandre Aubin 2020-03-31 05:45:51 +02:00
parent bb1eba88bf
commit 7b473212ad

View file

@ -106,15 +106,15 @@ def spdx_licenses():
# Actual high-level checks # Actual high-level checks
# ############################################################################ # ############################################################################
scriptnames = ["_common.sh", "install", "remove", "upgrade", "backup", "restore"]
class App(): class App():
def __init__(self, path): def __init__(self, path):
print_header("LOADING APP") print_header("LOADING APP")
self.path = path self.path = path
self.scripts = {f: Script(self.path, f) for f in scriptnames}
scripts = ["install", "remove", "upgrade", "backup", "restore"]
self.scripts = {f: Script(self.path, f) for f in scripts}
def analyze(self): def analyze(self):
@ -123,11 +123,7 @@ class App():
self.check_source_management() self.check_source_management()
self.check_manifest() self.check_manifest()
# Copypasta of lines from __init__ instead of using for script in [self.scripts[s] for s in scriptnames if self.scripts[s].exists]:
# self.script.values() because dict are unordered until python 3.7
scripts = ["install", "remove", "upgrade", "backup", "restore"]
for script in [self.scripts[s] for s in scripts]:
if script.exists:
script.analyze() script.analyze()
def misc_file_checks(self): def misc_file_checks(self):
@ -551,6 +547,10 @@ class Script():
return return
def check_set_usage(self): def check_set_usage(self):
if self.name == "_common.sh":
return
present = False present = False
if self.name in ["backup", "remove"]: if self.name in ["backup", "remove"]:
@ -579,6 +579,10 @@ class Script():
and suggest herlpers ynh_install_app_dependencies and ynh_remove_app_dependencies and suggest herlpers ynh_install_app_dependencies and ynh_remove_app_dependencies
""" """
# Skip this in common.sh, sometimes custom not-yet-official helpers need this
if self.name == "_common.sh":
return
if self.contains("ynh_package_install") or self.contains("apt-get install"): if self.contains("ynh_package_install") or self.contains("apt-get install"):
print_warning( print_warning(
"You should not use `ynh_package_install` or `apt-get install`, " "You should not use `ynh_package_install` or `apt-get install`, "