diff --git a/scripts/devops_tasks/build_packages.py b/scripts/devops_tasks/build_packages.py index e8bec139ac05..bc962c29e0a4 100644 --- a/scripts/devops_tasks/build_packages.py +++ b/scripts/devops_tasks/build_packages.py @@ -22,7 +22,18 @@ sys.path.append(tox_path) from sanitize_setup import process_requires -def build_packages(targeted_packages, distribution_directory, is_dev_build = False): + +def str_to_bool(input_string): + if isinstance(input_string, bool): + return input_string + elif input_string.lower() in ("true", "t", "1"): + return True + elif input_string.lower() in ("false", "f", "0"): + return False + else: + return False + +def build_packages(targeted_packages, distribution_directory, is_dev_build=False): # run the build and distribution for package_root in targeted_packages: print(package_root) @@ -93,7 +104,6 @@ def verify_update_package_requirement(pkg_root): ), ) - args = parser.parse_args() # We need to support both CI builds of everything and individual service @@ -104,5 +114,9 @@ def verify_update_package_requirement(pkg_root): else: target_dir = root_dir - targeted_packages = process_glob_string(args.glob_string, target_dir, args.package_filter_string) - build_packages(targeted_packages, args.distribution_directory, bool(args.is_dev_build)) + targeted_packages = process_glob_string( + args.glob_string, target_dir, args.package_filter_string + ) + build_packages( + targeted_packages, args.distribution_directory, str_to_bool(args.is_dev_build) + )