aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/wrapcc.py
blob: dd849fd6ec35009d6e7069d4507b657a6701c4ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import argparse
import subprocess
import sys, os


WRAPCC_ARGS_END='--wrapcc-end'

def fix(source_file: str, source_root: str):
    flags = []
    return flags

def parse_args():
    delimer = -1
    if WRAPCC_ARGS_END in sys.argv:
        delimer = sys.argv.index(WRAPCC_ARGS_END)
    assert delimer != -1, f"This wrapper should be called with {WRAPCC_ARGS_END} argument."

    parser = argparse.ArgumentParser()
    parser.add_argument('--source-file', required=True)
    parser.add_argument('--source-root', required=True)
    cc_cmd = sys.argv[delimer+1:]
    return parser.parse_args(sys.argv[1:delimer]), cc_cmd

if __name__ == '__main__':
    args, cc_cmd = parse_args()
    cmd = cc_cmd + fix(args.source_file, args.source_root)
    os.execv(cmd[0], cmd)