diff options
author | Ryan Beltran <ryanbeltran@chromium.org> | 2021-07-08 21:53:35 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-09 03:09:56 +0000 |
commit | bd4f0cee99022b12b382f288624bc4902dcfe1b6 (patch) | |
tree | e8f8f1b39ad159855f7ebca8d3a645fc48c9d3bc /compiler_wrapper | |
parent | 52f7bb64f1b8dbc617b3c8bd21ce3a10f36b786b (diff) | |
download | toolchain-utils-bd4f0cee99022b12b382f288624bc4902dcfe1b6.tar.gz |
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 <ryanbeltran@chromium.org>
Tested-by: Ryan Beltran <ryanbeltran@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rwxr-xr-x | compiler_wrapper/bundle.py | 17 |
1 files changed, 16 insertions, 1 deletions
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) |