From 7fbbd9aa9d1fb390d6835b224b3bc8a17b2ba76a Mon Sep 17 00:00:00 2001 From: Davide Gardenal <davide.gardenal@huawei.com> Date: Tue, 26 Jul 2022 12:24:11 +0200 Subject: [PATCH] upgrade_oniro.py: add global script options Add global script options. Change function name arg_parsing -> init_script_options to reflect better the behevior of the function. Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> --- scripts/upgrade_oniro.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade_oniro.py b/scripts/upgrade_oniro.py index 1768f078..5e018de1 100644 --- a/scripts/upgrade_oniro.py +++ b/scripts/upgrade_oniro.py @@ -46,7 +46,15 @@ import pathlib script_description = "[WIP] A tool to upgrade to a newer version of Oniro" -def arg_parsing(): +# Script options +target_version = "" +build_directory = pathlib.Path() +machine = "" +flavour = "" +image = "" +conf_directory = pathlib.Path() + +def init_script_options(): parser = argparse.ArgumentParser(description=script_description) # TODO a choice could be added in the version by checking all the tags of Oniro @@ -68,7 +76,14 @@ def arg_parsing(): help="Path to the config directory you want to use. If omitted the default configs will be use.") - return parser.parse_args() + parsed_args = vars(parser.parse_args()) + global target_version, build_directory, machine, flavour, image, conf_directory + target_version = parsed_args["target_version"] + build_directory = parsed_args["build_directory"] + machine = parsed_args["machine"] + flavour = parsed_args["flavour"] + image = parsed_args["image"] + conf_directory = parsed_args["conf_directory"] if __name__ == "__main__": - print(arg_parsing()) + init_script_options() -- GitLab