diff options
Diffstat (limited to 'Tools/build')
-rw-r--r-- | Tools/build/generate_opcode_h.py | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/Tools/build/generate_opcode_h.py b/Tools/build/generate_opcode_h.py index 344709a..643918c 100644 --- a/Tools/build/generate_opcode_h.py +++ b/Tools/build/generate_opcode_h.py @@ -1,4 +1,4 @@ -# This script generates the opcode.h header file. +# This script generates the pycore_opcode.h header file. import sys import tokenize @@ -6,27 +6,6 @@ import tokenize SCRIPT_NAME = "Tools/build/generate_opcode_h.py" PYTHON_OPCODE = "Lib/opcode.py" -opcode_h_header = f""" -// Auto-generated by {SCRIPT_NAME} from {PYTHON_OPCODE} - -#ifndef Py_OPCODE_H -#define Py_OPCODE_H -#ifdef __cplusplus -extern "C" {{ -#endif - -#include "opcode_ids.h" - -""".lstrip() - -opcode_h_footer = """ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OPCODE_H */ -""" - internal_header = f""" // Auto-generated by {SCRIPT_NAME} from {PYTHON_OPCODE} @@ -62,20 +41,10 @@ def get_python_module_dict(filename): return mod def main(opcode_py, - opcode_h='Include/opcode.h', internal_opcode_h='Include/internal/pycore_opcode.h'): opcode = get_python_module_dict(opcode_py) - with open(opcode_h, 'w') as fobj: - fobj.write(opcode_h_header) - - fobj.write("\n") - for i, (op, _) in enumerate(opcode["_nb_ops"]): - fobj.write(DEFINE.format(op, i)) - - fobj.write(opcode_h_footer) - with open(internal_opcode_h, 'w') as iobj: iobj.write(internal_header) @@ -91,8 +60,8 @@ def main(opcode_py, iobj.write(internal_footer) - print(f"{opcode_h} regenerated from {opcode_py}") + print(f"{internal_opcode_h} regenerated from {opcode_py}") if __name__ == '__main__': - main(sys.argv[1], sys.argv[2], sys.argv[3]) + main(sys.argv[1], sys.argv[2]) |