From 01aa39e3ff189fff96022c965c126f02c737ba03 Mon Sep 17 00:00:00 2001 From: Archana Date: Mon, 14 Mar 2022 15:29:00 +0530 Subject: [PATCH] Arg parse improvements Arg parse improved to update the input params path relative to mbedtls_root passed, if the other params are not explicitly passed. Signed-off-by: Archana Signed-off-by: Asfandyar Orakzai --- scripts/generate_driver_wrappers.py | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/generate_driver_wrappers.py b/scripts/generate_driver_wrappers.py index 3c71202d3..c025ed329 100755 --- a/scripts/generate_driver_wrappers.py +++ b/scripts/generate_driver_wrappers.py @@ -133,34 +133,34 @@ def main() -> int: returns 1 when read_driver_descriptions returns False """ def_arg_mbedtls_root = build_tree.guess_mbedtls_root() - def_arg_output_dir = os.path.join(def_arg_mbedtls_root, 'library') - def_arg_template_dir = os.path.join(def_arg_mbedtls_root, - 'scripts', - 'data_files', - 'driver_templates') - def_arg_json_dir = os.path.join(def_arg_mbedtls_root, - 'scripts', - 'data_files', - 'driver_jsons') parser = argparse.ArgumentParser() parser.add_argument('--mbedtls-root', nargs='?', default=def_arg_mbedtls_root, help='root directory of mbedtls source code') - parser.add_argument('--template-dir', nargs='?', default=def_arg_template_dir, + parser.add_argument('--template-dir', nargs='?', help='root directory of mbedtls source code') - parser.add_argument('--json-dir', nargs='?', default=def_arg_json_dir, + parser.add_argument('--json-dir', nargs='?', help='root directory of mbedtls source code') - parser.add_argument('output-directory', nargs='?', - default=def_arg_output_dir, help='output file\'s location') + parser.add_argument('output_directory', nargs='?', + help='output file\'s location') args = parser.parse_args() mbedtls_root = os.path.abspath(args.mbedtls_root) - output_directory = def_arg_output_dir if args.template_dir is None: - args.template_dir = os.path.join(args.mbedtls_root, def_arg_template_dir) - template_directory = args.template_dir + args.template_dir = os.path.join(mbedtls_root, + 'scripts', + 'data_files', + 'driver_templates') if args.json_dir is None: - args.json_dir = os.path.join(args.mbedtls_root, def_arg_json_dir) + args.json_dir = os.path.join(mbedtls_root, + 'scripts', + 'data_files', + 'driver_jsons') + if args.output_directory is None: + args.output_directory = os.path.join(mbedtls_root, 'library') + + output_directory = args.output_directory + template_directory = args.template_dir json_directory = args.json_dir # Read and validate list of driver jsons from driverlist.json