From 6cdab0625523d3c800ee60e583ed01818fc989dc Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Wed, 15 Dec 2021 08:22:15 -0800 Subject: [PATCH] Enable argument files in build.py. (#10040) --- tools/ci_build/build.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/build.py b/tools/ci_build/build.py index 0c84ef93d9..36aaa5da58 100644 --- a/tools/ci_build/build.py +++ b/tools/ci_build/build.py @@ -125,9 +125,14 @@ def _openvino_verify_device_type(device_read): def parse_arguments(): - parser = argparse.ArgumentParser( + class Parser(argparse.ArgumentParser): + # override argument file line parsing behavior - allow multiple arguments per line and handle quotes + def convert_arg_line_to_args(self, arg_line): + return shlex.split(arg_line) + + parser = Parser( description="ONNXRuntime CI build driver.", - usage=""" # noqa + usage=""" Default behavior is --update --build --test for native architecture builds. Default behavior is --update --build for cross-compiled builds. @@ -136,7 +141,10 @@ def parse_arguments(): The Test phase will run all unit tests, and optionally the ONNX tests. Use the individual flags to only run the specified stages. - """) + """, + # files containing arguments can be specified on the command line with "@" and the arguments within + # will be included at that point + fromfile_prefix_chars="@") # Main arguments parser.add_argument( "--build_dir", required=True, help="Path to the build directory.")