From 0749b9fd6ffea39b30d54893a4d46669e5cd6bcc Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 4 Aug 2022 17:05:46 +0200 Subject: [PATCH] Fix v2 packaging convert script (_common.sh may not exist) --- packaging_v2/convert_app_to_packaging_v2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packaging_v2/convert_app_to_packaging_v2.py b/packaging_v2/convert_app_to_packaging_v2.py index 21fe774..b2a11c3 100644 --- a/packaging_v2/convert_app_to_packaging_v2.py +++ b/packaging_v2/convert_app_to_packaging_v2.py @@ -101,8 +101,8 @@ def _convert_v1_manifest_to_v2(app_path): manifest["resources"]["ports"][f"{name}.exposed"] = exposed maybequote = "[\"'\"'\"']?" - apt_dependencies = check_output(f"sed -nr 's/.*_dependencies={maybequote}(.*){maybequote}? *$/\\1/p' '{app_path}/scripts/_common.sh' | tr -d '\"' | sed 's@ @\\n@g'") - php_version = check_output(f"sed -nr 's/^ *YNH_PHP_VERSION={maybequote}(.*){maybequote}?$/\\1/p' '{app_path}/scripts/_common.sh' | tr -d \"\\\"'\"") + apt_dependencies = check_output(f"sed -nr 's/.*_dependencies={maybequote}(.*){maybequote}? *$/\\1/p' '{app_path}/scripts/_common.sh' 2>/dev/null | tr -d '\"' | sed 's@ @\\n@g'") + php_version = check_output(f"sed -nr 's/^ *YNH_PHP_VERSION={maybequote}(.*){maybequote}?$/\\1/p' '{app_path}/scripts/_common.sh' 2>/dev/null | tr -d \"\\\"'\"") if apt_dependencies.strip(): if php_version: apt_dependencies = apt_dependencies.replace("${YNH_PHP_VERSION}", php_version) @@ -283,6 +283,9 @@ def cleanup_scripts_and_conf(folder): script = f"{folder}/scripts/{s}" + if not os.path.exists(script): + continue + content = open(script).read() for pattern in patterns_to_remove_in_scripts: