bpo-47152: Automatically regenerate sre_constants.h (GH-91439)

* Move the code for generating Modules/_sre/sre_constants.h from
  Lib/re/_constants.py into a separate script
  Tools/scripts/generate_sre_constants.py.
* Add target `regen-sre` in the makefile.
* Make target `regen-all` depending on `regen-sre`.
This commit is contained in:
Serhiy Storchaka 2022-04-12 18:34:06 +03:00 committed by GitHub
parent 943ca5e1d6
commit 474fdbe9e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 46 deletions

View file

@ -1197,7 +1197,7 @@ regen-limited-abi: all
# Regenerate all generated files
regen-all: regen-opcode regen-opcode-targets regen-typeslots \
regen-token regen-ast regen-keyword regen-frozen clinic \
regen-token regen-ast regen-keyword regen-sre regen-frozen clinic \
regen-pegen-metaparser regen-pegen regen-test-frozenmain \
regen-global-objects
@echo
@ -1350,6 +1350,13 @@ regen-stdlib-module-names: build_all Programs/_testembed
> $(srcdir)/Python/stdlib_module_names.h.new
$(UPDATE_FILE) $(srcdir)/Python/stdlib_module_names.h $(srcdir)/Python/stdlib_module_names.h.new
regen-sre:
# Regenerate Modules/_sre/sre_constants.h from Lib/re/_constants.py
# using Tools/scripts/generate_sre_constants.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_sre_constants.py \
$(srcdir)/Lib/re/_constants.py \
$(srcdir)/Modules/_sre/sre_constants.h
Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o: $(srcdir)/Include/internal/pycore_ast.h
Python/getplatform.o: $(srcdir)/Python/getplatform.c