Merge pull request #27 from YunoHost/return_value

Return value
This commit is contained in:
M5oul 2017-04-11 10:17:12 +02:00 committed by GitHub
commit 2633503658

View file

@ -37,6 +37,7 @@ def print_wrong(str):
def check_files_exist(app_path): def check_files_exist(app_path):
""" """
Check files exist Check files exist
'backup' and 'restore' scripts are mandatory
""" """
return_code = 0 return_code = 0
@ -44,11 +45,12 @@ def check_files_exist(app_path):
fnames = ("manifest.json", "scripts/install", "scripts/remove", fnames = ("manifest.json", "scripts/install", "scripts/remove",
"scripts/upgrade", "scripts/backup", "scripts/restore", "LICENSE", "README.md") "scripts/upgrade", "scripts/backup", "scripts/restore", "LICENSE", "README.md")
for fname in fnames: for nbr, fname in enumerate(fnames):
if check_file_exist(app_path + "/" + fname): if check_file_exist(app_path + "/" + fname):
print_right(fname) print_right(fname)
else: else:
print_wrong(fname) print_wrong(fname)
if nbr != 4 and nbr != 5:
return_code = 1 return_code = 1
return return_code return return_code
@ -183,7 +185,7 @@ def check_script(path, script_name, script_nbr):
return_code = check_non_helpers_usage(script) or return_code return_code = check_non_helpers_usage(script) or return_code
if script_nbr < 5: if script_nbr < 5:
return_code = check_verifications_done_before_modifying_system(script) or return_code check_verifications_done_before_modifying_system(script)
return_code = check_set_usage(script_name, script) or return_code return_code = check_set_usage(script_name, script) or return_code
check_arg_retrieval(script) check_arg_retrieval(script)
@ -223,6 +225,7 @@ def check_verifications_done_before_modifying_system(script):
"Verifications (with 'ynh_die' or 'exit' commands) are done before any system modification.") "Verifications (with 'ynh_die' or 'exit' commands) are done before any system modification.")
return 0 return 0
def check_non_helpers_usage(script): def check_non_helpers_usage(script):
""" """
check if deprecated commands are used and propose helpers: check if deprecated commands are used and propose helpers:
@ -297,7 +300,7 @@ def check_arg_retrieval(script):
if line_nbr > 30: if line_nbr > 30:
exitFlag = True exitFlag = True
break break
if exitFlag == True: if exitFlag is True:
break break
if present: if present: