added --dryrun
This commit is contained in:
parent
5fd70b614d
commit
b819a22205
1 changed files with 8 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue