|
17 | 17 | # ============================= Constants / Globals ============================ |
18 | 18 | DIR = Path(".") |
19 | 19 | OUTPUT = DIR / "mpi.h" |
| 20 | +INPUT = DIR / "abi.h.in" |
20 | 21 | JSON_PATH = DIR / "abi.json" |
21 | 22 |
|
22 | 23 | ABI_INTERNAL = "_ABI_INTERNAL" |
|
69 | 70 | # ============================== Argument Parsing ============================== |
70 | 71 | parser = argparse.ArgumentParser() |
71 | 72 | parser.add_argument("--abi-json", type=str, help=f"path to ABI JSON file [{DIR}/]") |
72 | | -parser.add_argument("-o", "--output", type=str, help="output directory for the header file") |
| 73 | +parser.add_argument("-i", "--input", type=str, help="input path for the .h.in file") |
| 74 | +parser.add_argument("-o", "--output", type=str, help="output path for the header file") |
73 | 75 | parser.add_argument("--mangle-names", help="enable name mangling for constants and datatypes", action="store_true") |
74 | 76 | parser.add_argument("--no-mangle", help="disable name mangling (default)", action="store_true") |
75 | 77 |
|
|
83 | 85 | MANGLE_NAMES = False |
84 | 86 | if args.output: |
85 | 87 | OUTPUT = Path(args.output) |
| 88 | +if args.input: |
| 89 | + INPUT = Path(args.input) |
86 | 90 |
|
87 | 91 | # ================================== Load JSON ================================= |
88 | 92 | with open(JSON_PATH) as f: |
@@ -132,7 +136,7 @@ def output_constant(const, use_enum: bool, mangle_name: bool): |
132 | 136 |
|
133 | 137 | # ========================= Manipulate Template Header ========================= |
134 | 138 | lines = [] |
135 | | -with open(DIR / "abi.h.in", 'r') as header_in: |
| 139 | +with open(INPUT, 'r') as header_in: |
136 | 140 | lines = header_in.readlines() |
137 | 141 |
|
138 | 142 | # Match lines that start with `$CATEGORY:`. Any amount of whitespace is allowed |
|
0 commit comments