summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-08-17 16:07:58 (GMT)
committerGitHub <noreply@github.com>2023-08-17 16:07:58 (GMT)
commit0b243c2f665e6784b74ac4d602d4ee429a2ad7f0 (patch)
tree5444c3a7fa1cb2d85a916f3a2773b509c4da2523 /Tools
parent4cb08188e8f0faaec303e268e12aa1d6f54017f7 (diff)
downloadcpython-0b243c2f665e6784b74ac4d602d4ee429a2ad7f0.zip
cpython-0b243c2f665e6784b74ac4d602d4ee429a2ad7f0.tar.gz
cpython-0b243c2f665e6784b74ac4d602d4ee429a2ad7f0.tar.bz2
gh-105481: opcode.h is no longer generated during the build (#108080)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/build/generate_opcode_h.py37
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])