bpo-47146: Stop Depending On regen-deepfreeze For regen-global-objects (gh-32218)
https://github.com/python/cpython/commit/e7bb7c2f047b4f97e4426c42ae209c96980... commit: e7bb7c2f047b4f97e4426c42ae209c969808069d branch: main author: Eric Snow <ericsnowcurrently@gmail.com> committer: ericsnowcurrently <ericsnowcurrently@gmail.com> date: 2022-03-31T14:29:52-06:00 summary: 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 files: M .github/workflows/build.yml M Makefile.pre.in M Tools/scripts/freeze_modules.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bda6dde37d185..0ca8d3910814a 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 e784b43d0362d..6dda71bc49cff 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 c8d8a7dd1fbab..dd208c7847194 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(" \\")
participants (1)
-
ericsnowcurrently