From e7bb7c2f047b4f97e4426c42ae209c969808069d Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 31 Mar 2022 14:29:52 -0600 Subject: bpo-47146: Stop Depending On regen-deepfreeze For regen-global-objects (gh-32218) This effectively reverts the Makefile change in gh-31637. I've added some notes so it is more clear what is going on. We also update the "Check if generated files are up to date" job to run "make regen-deepfreeze" to ensure "make regen-global-objects" catches deepfreeze.c. https://bugs.python.org/issue47146 --- .github/workflows/build.yml | 3 +++ Makefile.pre.in | 24 ++++++------------------ Tools/scripts/freeze_modules.py | 1 - 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bda6dde..0ca8d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,6 +82,9 @@ jobs: run: make regen-configure - name: Build CPython run: | + # Deepfreeze will usually cause global objects to be added or removed, + # so we run it before regen-global-objects gets rum (in regen-all). + make regen-deepfreeze make -j4 regen-all make regen-stdlib-module-names - name: Check for changes diff --git a/Makefile.pre.in b/Makefile.pre.in index e784b43..6dda71b 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1161,8 +1161,9 @@ Python/deepfreeze/deepfreeze.c: $(DEEPFREEZE_DEPS) Python/frozen_modules/__phello__.spam.h:__phello__.spam \ Python/frozen_modules/frozen_only.h:frozen_only \ -o Python/deepfreeze/deepfreeze.c - # END: deepfreeze modules + @echo "Note: Deepfreeze may have added some global objects," + @echo " so run 'make regen-global-objects' if necessary." # We keep this renamed target around for folks with muscle memory. .PHONY: regen-importlib @@ -1171,24 +1172,11 @@ regen-importlib: regen-frozen ############################################################################ # Global objects -GLOBAL_OBJECTS_TARGETS = \ - $(srcdir)/Include/internal/pycore_global_objects.h \ - $(srcdir)/Include/internal/pycore_global_strings.h - -# The global objects will get regenerated as soon these files -# are required, including as a prerequisite for regen-deepfreeze. -$(GLOBAL_OBJECTS_TARGETS): generate-global-objects - -.PHONY: generate-global-objects -generate-global-objects: $(srcdir)/Tools/scripts/generate_global_objects.py - $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_global_objects.py - -.PHONY: generate-global-objects-after-deepfreeze -generate-global-objects-after-deepfreeze: regen-deepfreeze $(srcdir)/Tools/scripts/generate_global_objects.py - $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_global_objects.py - .PHONY: regen-global-objects -regen-global-objects: regen-deepfreeze generate-global-objects-after-deepfreeze +regen-global-objects: $(srcdir)/Tools/scripts/generate_global_objects.py + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_global_objects.py + @echo "Note: Global objects can be added or removed by other tools (e.g. deepfreeze), " + @echo " so be sure to re-run regen-global-objects after those tools." ############################################################################ # ABI diff --git a/Tools/scripts/freeze_modules.py b/Tools/scripts/freeze_modules.py index c8d8a7d..dd208c7 100644 --- a/Tools/scripts/freeze_modules.py +++ b/Tools/scripts/freeze_modules.py @@ -606,7 +606,6 @@ def regen_makefile(modules): ]) deepfreezerules.append(f"\t{frozen_header}:{src.frozenid} \\") deepfreezerules.append('\t-o Python/deepfreeze/deepfreeze.c') - deepfreezerules.append('') pyfiles[-1] = pyfiles[-1].rstrip(" \\") frozenfiles[-1] = frozenfiles[-1].rstrip(" \\") -- cgit v0.12