summaryrefslogtreecommitdiffstats
path: root/Makefile.pre.in
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-01-19 22:04:49 (GMT)
committerGitHub <noreply@github.com>2021-01-19 22:04:49 (GMT)
commitcad8020cb83ec6d904f874c0e4f599e651022196 (patch)
tree7db4f105af783ecd5ac60488b081d945bcea14b3 /Makefile.pre.in
parente8e66eab941b983b6e85cd0d57cd45838880c568 (diff)
downloadcpython-cad8020cb83ec6d904f874c0e4f599e651022196.zip
cpython-cad8020cb83ec6d904f874c0e4f599e651022196.tar.gz
cpython-cad8020cb83ec6d904f874c0e4f599e651022196.tar.bz2
bpo-42955: Add Python/module_names.h (GH-24258)
Add a private list of all stdlib modules: _Py_module_names. * Add Tools/scripts/generate_module_names.py script. * Makefile: Add "make regen-module-names" command. * setup.py: Add --list-module-names option. * GitHub Action and Travis CI also runs "make regen-module-names", not ony "make regen-all", to ensure that the module names remains up to date.
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in17
1 files changed, 15 insertions, 2 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 5605a88..fa0b9d8 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -252,7 +252,7 @@ PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
-UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
+UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
BUILD_GNU_TYPE= @build@
@@ -757,6 +757,8 @@ regen-limited-abi: all
regen-all: regen-opcode regen-opcode-targets regen-typeslots \
regen-token regen-ast regen-keyword regen-importlib clinic \
regen-pegen-metaparser regen-pegen
+ @echo
+ @echo "Note: make regen-module-names and autoconf should be run manually"
############################################################################
# Special rules for object files
@@ -896,6 +898,15 @@ regen-keyword:
$(srcdir)/Lib/keyword.py.new
$(UPDATE_FILE) $(srcdir)/Lib/keyword.py $(srcdir)/Lib/keyword.py.new
+.PHONY: regen-module-names
+regen-module-names: build_all
+ # Regenerate Python/module_names.h
+ # using Tools/scripts/generate_module_names.py
+ $(RUNSHARED) ./$(BUILDPYTHON) \
+ $(srcdir)/Tools/scripts/generate_module_names.py \
+ > $(srcdir)/Python/module_names.h.new
+ $(UPDATE_FILE) $(srcdir)/Python/module_names.h $(srcdir)/Python/module_names.h.new
+
Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o: $(srcdir)/Include/Python-ast.h
Python/getplatform.o: $(srcdir)/Python/getplatform.c
@@ -1145,7 +1156,9 @@ PYTHON_HEADERS= \
$(srcdir)/Include/internal/pycore_ucnhash.h \
$(srcdir)/Include/internal/pycore_unionobject.h \
$(srcdir)/Include/internal/pycore_warnings.h \
- $(DTRACE_HEADERS)
+ $(DTRACE_HEADERS) \
+ \
+ $(srcdir)/Python/module_names.h
$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)