From bd4f0cee99022b12b382f288624bc4902dcfe1b6 Mon Sep 17 00:00:00 2001 From: Ryan Beltran Date: Thu, 8 Jul 2021 21:53:35 +0000 Subject: compiler_wrapper: bundle.py default output dir This CL implements defaulting the output directory for bundle.py to the location of compiler wrapper files in third_party/chromiumos-overlay. This also prevents bundle.py from creating directories unless a new --create flag is specified. BUG=None TEST=Manually tested Change-Id: I64d055a73332d3faafad730beda30886212346ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3016910 Commit-Queue: Ryan Beltran Tested-by: Ryan Beltran Reviewed-by: George Burgess --- compiler_wrapper/bundle.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'compiler_wrapper') diff --git a/compiler_wrapper/bundle.py b/compiler_wrapper/bundle.py index 27b422f3..6df82146 100755 --- a/compiler_wrapper/bundle.py +++ b/compiler_wrapper/bundle.py @@ -18,7 +18,18 @@ import sys def parse_args(): parser = argparse.ArgumentParser() - parser.add_argument('output_dir') + default_output_dir = os.path.normpath( + os.path.join( + os.path.dirname(os.path.realpath(__file__)), + '../../chromiumos-overlay/sys-devel/llvm/files/compiler_wrapper')) + parser.add_argument( + '--output_dir', + default=default_output_dir, + help='Output directory to place bundled files (default: %(default)s)') + parser.add_argument( + '--create', + action='store_true', + help='Create output_dir if it does not already exist') return parser.parse_args() @@ -57,6 +68,10 @@ def main(): args = parse_args() input_dir = os.path.dirname(__file__) change_id = read_change_id(input_dir) + if not args.create: + assert os.path.exists( + args.output_dir + ), f'Specified output directory ({args.output_dir}) does not exist' shutil.rmtree(args.output_dir, ignore_errors=True) os.makedirs(args.output_dir) copy_files(input_dir, args.output_dir) -- cgit v1.2.3