From b819a222053351cf6e19d3d6a5297a66f91129d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Mon, 4 May 2020 14:16:50 +0000 Subject: [PATCH] added --dryrun --- scripts/run_ninja.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/run_ninja.py b/scripts/run_ninja.py index 16972b5..f886837 100755 --- a/scripts/run_ninja.py +++ b/scripts/run_ninja.py @@ -18,15 +18,20 @@ import os import platform import subprocess -def run_ninja(target: str, repo_path: str): + +def run_ninja(target: str, repo_path: str, *, dryrun:bool = False): build_dir = os.path.join(repo_path, 'build') cmd = 'ninja {}'.format(target) - subprocess.check_call(cmd, shell=True, cwd=build_dir) + if dryrun: + print('Dryrun. Command would have been:\n{}'.format(cmd)) + else: + subprocess.check_call(cmd, shell=True, cwd=build_dir) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Run ninja for LLVM.') parser.add_argument('target') parser.add_argument('repo_path', type=str, nargs='?', default=os.getcwd()) + parser.add_argument('--dryrun', action='store_true') args = parser.parse_args() - run_ninja(args.target, args.repo_path) + run_ninja(args.target, args.repo_path, dryrun=args.dryrun)