diff --git a/Makefile.pre.in b/Makefile.pre.in index d52f73620795c1e..2e3aab762a376cb 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -275,7 +275,6 @@ LIBOBJS= @LIBOBJS@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) -BOOTSTRAP= _bootstrap_python PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py @@ -710,9 +709,9 @@ platform: $(BUILDPYTHON) pybuilddir.txt # problems by creating a dummy pybuilddir.txt just to allow interpreter # initialization to succeed. It will be overwritten by generate-posix-vars # or removed in case of failure. -pybuilddir.txt: $(BOOTSTRAP) +pybuilddir.txt: $(BUILDPYTHON) @echo "none" > ./pybuilddir.txt - ./$(BOOTSTRAP) -S -m sysconfig --generate-posix-vars ;\ + $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ if test $$? -ne 0 ; then \ echo "generate-posix-vars failed" ; \ rm -f ./pybuilddir.txt ; \ @@ -934,155 +933,75 @@ regen-test-frozenmain: $(BUILDPYTHON) Programs/_testembed: Programs/_testembed.o $(LIBRARY_DEPS) $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) -############################################################################ -# "Bootstrap Python" used to run deepfreeze.py - -BOOTSTRAP_HEADERS = \ - Python/frozen_modules/importlib._bootstrap.h \ - Python/frozen_modules/importlib._bootstrap_external.h \ - Python/frozen_modules/zipimport.h - -Python/bootstrap_frozen.o: Python/bootstrap_frozen.c Include/cpython/import.h $(BOOTSTRAP_HEADERS) - -$(BOOTSTRAP): $(LIBRARY_OBJS_OMIT_FROZEN) \ - Python/bootstrap_frozen.o Programs/python.o - $(LINKCC) $(PY_CORE_LDFLAGS) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \ - Python/bootstrap_frozen.o \ - Programs/python.o \ - $(LIBS) $(MODLIBS) $(SYSLIBS) - ############################################################################ # Deepfreeze targets .PHONY: regen-deepfreeze regen-deepfreeze: $(DEEPFREEZE_OBJS) -DEEPFREEZE_DEPS = \ - $(BOOTSTRAP) \ - pybuilddir.txt \ - $(srcdir)/Tools/scripts/deepfreeze.py +DEEPFREEZE_DEPS=$(srcdir)/Tools/scripts/deepfreeze.py # BEGIN: deepfreeze modules -Python/deepfreeze/importlib._bootstrap.c: $(srcdir)/Lib/importlib/_bootstrap.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/importlib._bootstrap.c from Lib/importlib/_bootstrap.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/importlib/_bootstrap.py -m importlib._bootstrap -o Python/deepfreeze/importlib._bootstrap.c - -Python/deepfreeze/importlib._bootstrap_external.c: $(srcdir)/Lib/importlib/_bootstrap_external.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/importlib._bootstrap_external.c from Lib/importlib/_bootstrap_external.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/importlib/_bootstrap_external.py -m importlib._bootstrap_external -o Python/deepfreeze/importlib._bootstrap_external.c - -Python/deepfreeze/zipimport.c: $(srcdir)/Lib/zipimport.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/zipimport.c from Lib/zipimport.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/zipimport.py -m zipimport -o Python/deepfreeze/zipimport.c - -Python/deepfreeze/abc.c: $(srcdir)/Lib/abc.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/abc.c from Lib/abc.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/abc.py -m abc -o Python/deepfreeze/abc.c - -Python/deepfreeze/codecs.c: $(srcdir)/Lib/codecs.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/codecs.c from Lib/codecs.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/codecs.py -m codecs -o Python/deepfreeze/codecs.c - -Python/deepfreeze/io.c: $(srcdir)/Lib/io.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/io.c from Lib/io.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/io.py -m io -o Python/deepfreeze/io.c - -Python/deepfreeze/_collections_abc.c: $(srcdir)/Lib/_collections_abc.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/_collections_abc.c from Lib/_collections_abc.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/_collections_abc.py -m _collections_abc -o Python/deepfreeze/_collections_abc.c - -Python/deepfreeze/_sitebuiltins.c: $(srcdir)/Lib/_sitebuiltins.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/_sitebuiltins.c from Lib/_sitebuiltins.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/_sitebuiltins.py -m _sitebuiltins -o Python/deepfreeze/_sitebuiltins.c - -Python/deepfreeze/genericpath.c: $(srcdir)/Lib/genericpath.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/genericpath.c from Lib/genericpath.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/genericpath.py -m genericpath -o Python/deepfreeze/genericpath.c - -Python/deepfreeze/ntpath.c: $(srcdir)/Lib/ntpath.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/ntpath.c from Lib/ntpath.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/ntpath.py -m ntpath -o Python/deepfreeze/ntpath.c - -Python/deepfreeze/posixpath.c: $(srcdir)/Lib/posixpath.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/posixpath.c from Lib/posixpath.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/posixpath.py -m posixpath -o Python/deepfreeze/posixpath.c - -Python/deepfreeze/os.c: $(srcdir)/Lib/os.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/os.c from Lib/os.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/os.py -m os -o Python/deepfreeze/os.c - -Python/deepfreeze/site.c: $(srcdir)/Lib/site.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/site.c from Lib/site.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/site.py -m site -o Python/deepfreeze/site.c - -Python/deepfreeze/stat.c: $(srcdir)/Lib/stat.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/stat.c from Lib/stat.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/stat.py -m stat -o Python/deepfreeze/stat.c - -Python/deepfreeze/__hello__.c: $(srcdir)/Lib/__hello__.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/__hello__.c from Lib/__hello__.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/__hello__.py -m __hello__ -o Python/deepfreeze/__hello__.c - -Python/deepfreeze/__phello__.c: $(srcdir)/Lib/__phello__/__init__.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/__phello__.c from Lib/__phello__/__init__.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/__phello__/__init__.py -m __phello__ -o Python/deepfreeze/__phello__.c - -Python/deepfreeze/__phello__.ham.c: $(srcdir)/Lib/__phello__/ham/__init__.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/__phello__.ham.c from Lib/__phello__/ham/__init__.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/__phello__/ham/__init__.py -m __phello__.ham -o Python/deepfreeze/__phello__.ham.c - -Python/deepfreeze/__phello__.ham.eggs.c: $(srcdir)/Lib/__phello__/ham/eggs.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/__phello__.ham.eggs.c from Lib/__phello__/ham/eggs.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/__phello__/ham/eggs.py -m __phello__.ham.eggs -o Python/deepfreeze/__phello__.ham.eggs.c - -Python/deepfreeze/__phello__.spam.c: $(srcdir)/Lib/__phello__/spam.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/__phello__.spam.c from Lib/__phello__/spam.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Lib/__phello__/spam.py -m __phello__.spam -o Python/deepfreeze/__phello__.spam.c - -Python/deepfreeze/frozen_only.c: $(srcdir)/Tools/freeze/flag.py $(DEEPFREEZE_DEPS) - @echo "Deepfreezing Python/deepfreeze/frozen_only.c from Tools/freeze/flag.py" - @./$(BOOTSTRAP) \ - $(srcdir)/Tools/scripts/deepfreeze.py \ - $(srcdir)/Tools/freeze/flag.py -m frozen_only -o Python/deepfreeze/frozen_only.c +Python/deepfreeze/importlib._bootstrap.c: $(srcdir)/Python/frozen_modules/importlib._bootstrap.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/importlib._bootstrap.h -m importlib._bootstrap -o Python/deepfreeze/importlib._bootstrap.c + +Python/deepfreeze/importlib._bootstrap_external.c: $(srcdir)/Python/frozen_modules/importlib._bootstrap_external.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/importlib._bootstrap_external.h -m importlib._bootstrap_external -o Python/deepfreeze/importlib._bootstrap_external.c + +Python/deepfreeze/zipimport.c: $(srcdir)/Python/frozen_modules/zipimport.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/zipimport.h -m zipimport -o Python/deepfreeze/zipimport.c + +Python/deepfreeze/abc.c: $(srcdir)/Python/frozen_modules/abc.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/abc.h -m abc -o Python/deepfreeze/abc.c + +Python/deepfreeze/codecs.c: $(srcdir)/Python/frozen_modules/codecs.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/codecs.h -m codecs -o Python/deepfreeze/codecs.c + +Python/deepfreeze/io.c: $(srcdir)/Python/frozen_modules/io.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/io.h -m io -o Python/deepfreeze/io.c + +Python/deepfreeze/_collections_abc.c: $(srcdir)/Python/frozen_modules/_collections_abc.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/_collections_abc.h -m _collections_abc -o Python/deepfreeze/_collections_abc.c + +Python/deepfreeze/_sitebuiltins.c: $(srcdir)/Python/frozen_modules/_sitebuiltins.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/_sitebuiltins.h -m _sitebuiltins -o Python/deepfreeze/_sitebuiltins.c + +Python/deepfreeze/genericpath.c: $(srcdir)/Python/frozen_modules/genericpath.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/genericpath.h -m genericpath -o Python/deepfreeze/genericpath.c + +Python/deepfreeze/ntpath.c: $(srcdir)/Python/frozen_modules/ntpath.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/ntpath.h -m ntpath -o Python/deepfreeze/ntpath.c + +Python/deepfreeze/posixpath.c: $(srcdir)/Python/frozen_modules/posixpath.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/posixpath.h -m posixpath -o Python/deepfreeze/posixpath.c + +Python/deepfreeze/os.c: $(srcdir)/Python/frozen_modules/os.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/os.h -m os -o Python/deepfreeze/os.c + +Python/deepfreeze/site.c: $(srcdir)/Python/frozen_modules/site.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/site.h -m site -o Python/deepfreeze/site.c + +Python/deepfreeze/stat.c: $(srcdir)/Python/frozen_modules/stat.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/stat.h -m stat -o Python/deepfreeze/stat.c + +Python/deepfreeze/__hello__.c: $(srcdir)/Python/frozen_modules/__hello__.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/__hello__.h -m __hello__ -o Python/deepfreeze/__hello__.c + +Python/deepfreeze/__phello__.c: $(srcdir)/Python/frozen_modules/__phello__.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/__phello__.h -m __phello__ -o Python/deepfreeze/__phello__.c + +Python/deepfreeze/__phello__.ham.c: $(srcdir)/Python/frozen_modules/__phello__.ham.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/__phello__.ham.h -m __phello__.ham -o Python/deepfreeze/__phello__.ham.c + +Python/deepfreeze/__phello__.ham.eggs.c: $(srcdir)/Python/frozen_modules/__phello__.ham.eggs.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/__phello__.ham.eggs.h -m __phello__.ham.eggs -o Python/deepfreeze/__phello__.ham.eggs.c + +Python/deepfreeze/__phello__.spam.c: $(srcdir)/Python/frozen_modules/__phello__.spam.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/__phello__.spam.h -m __phello__.spam -o Python/deepfreeze/__phello__.spam.c + +Python/deepfreeze/frozen_only.c: $(srcdir)/Python/frozen_modules/frozen_only.h $(DEEPFREEZE_DEPS) + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/deepfreeze.py $(srcdir)/Python/frozen_modules/frozen_only.h -m frozen_only -o Python/deepfreeze/frozen_only.c # END: deepfreeze modules @@ -2367,7 +2286,7 @@ clean-retain-profile: pycremoval find build -name '*.py[co]' -exec rm -f {} ';' || true -rm -f pybuilddir.txt -rm -f Lib/lib2to3/*Grammar*.pickle - -rm -f Programs/_testembed Programs/_freeze_module $(BOOTSTRAP) + -rm -f Programs/_testembed Programs/_freeze_module -rm -f Python/deepfreeze/*.[co] -find build -type f -a ! -name '*.gc??' -exec rm -f {} ';' -rm -f Include/pydtrace_probes.h diff --git a/Tools/scripts/freeze_modules.py b/Tools/scripts/freeze_modules.py index 61ccae61e4f965c..6614a2518f4f08a 100644 --- a/Tools/scripts/freeze_modules.py +++ b/Tools/scripts/freeze_modules.py @@ -25,31 +25,6 @@ # need to be updated. MODULES_DIR = os.path.join(ROOT_DIR, 'Python', 'frozen_modules') -if sys.platform != "win32": - TOOL = os.path.join(ROOT_DIR, 'Programs', '_freeze_module') - if not os.path.isfile(TOOL): - # When building out of the source tree, get the tool from directory - # of the Python executable - TOOL = os.path.dirname(sys.executable) - TOOL = os.path.join(TOOL, 'Programs', '_freeze_module') - TOOL = os.path.abspath(TOOL) - if not os.path.isfile(TOOL): - sys.exit("ERROR: missing _freeze_module") -else: - def find_tool(): - archs = ['amd64', 'win32'] - if platform.machine() == "ARM64": - archs.append('arm64') - for arch in archs: - for exe in ['_freeze_module.exe', '_freeze_module_d.exe']: - tool = os.path.join(ROOT_DIR, 'PCbuild', arch, exe) - if os.path.isfile(tool): - return tool - sys.exit("ERROR: missing _freeze_module.exe; you need to run PCbuild/build.bat") - TOOL = find_tool() - del find_tool - -MANIFEST = os.path.join(MODULES_DIR, 'MANIFEST') FROZEN_FILE = os.path.join(ROOT_DIR, 'Python', 'frozen.c') MAKEFILE = os.path.join(ROOT_DIR, 'Makefile.pre.in') PCBUILD_PROJECT = os.path.join(ROOT_DIR, 'PCbuild', '_freeze_module.vcxproj') @@ -480,45 +455,6 @@ def replace_block(lines, start_marker, end_marker, replacements, file): return lines[:start_pos + 1] + replacements + lines[end_pos:] -def regen_manifest(modules): - header = 'module ispkg source frozen checksum'.split() - widths = [5] * len(header) - rows = [] - for mod in modules: - info = mod.summarize() - row = [] - for i, col in enumerate(header): - value = info[col] - if col == 'checksum': - value = value[:12] - elif col == 'ispkg': - value = 'YES' if value else 'no' - widths[i] = max(widths[i], len(value)) - row.append(value or '-') - rows.append(row) - - modlines = [ - '# The list of frozen modules with key information.', - '# Note that the "check_generated_files" CI job will identify', - '# when source files were changed but regen-frozen wasn\'t run.', - '# This file is auto-generated by Tools/scripts/freeze_modules.py.', - ' '.join(c.center(w) for c, w in zip(header, widths)).rstrip(), - ' '.join('-' * w for w in widths), - ] - for row in rows: - for i, w in enumerate(widths): - if header[i] == 'ispkg': - row[i] = row[i].center(w) - else: - row[i] = row[i].ljust(w) - modlines.append(' '.join(row).rstrip()) - - print(f'# Updating {os.path.relpath(MANIFEST)}') - with open(MANIFEST, 'w', encoding="utf-8") as outfile: - lines = (l + '\n' for l in modlines) - outfile.writelines(lines) - - def regen_frozen(modules): headerlines = [] parentdir = os.path.dirname(FROZEN_FILE) @@ -648,11 +584,11 @@ def regen_makefile(modules): deepfreezefiles.append(f"\t\t{ofile} \\") # Also add a deepfreeze rule. - deepfreezerules.append(f'{cfile}: $(srcdir)/{_pyfile} $(DEEPFREEZE_DEPS)') - deepfreezerules.append(f'\t@echo "Deepfreezing {cfile} from {_pyfile}"') - deepfreezerules.append(f"\t@./$(BOOTSTRAP) \\") - deepfreezerules.append(f"\t\t$(srcdir)/Tools/scripts/deepfreeze.py \\") - deepfreezerules.append(f"\t\t$(srcdir)/{_pyfile} -m {src.frozenid} -o {cfile}") + deepfreezerules.append(f'{cfile}: $(srcdir)/{header} $(DEEPFREEZE_DEPS)') + deepfreezerules.append( + f"\t$(PYTHON_FOR_REGEN) " + f"$(srcdir)/Tools/scripts/deepfreeze.py " + f"$(srcdir)/{header} -m {src.frozenid} -o {cfile}") deepfreezerules.append('') for src in _iter_sources(modules): @@ -774,32 +710,6 @@ def regen_pcbuild(modules): outfile.writelines(lines) -####################################### -# freezing modules - -def freeze_module(modname, pyfile=None, destdir=MODULES_DIR): - """Generate the frozen module .h file for the given module.""" - tmpsuffix = f'.{int(time.time())}' - for modname, pyfile, ispkg in resolve_modules(modname, pyfile): - frozenfile = resolve_frozen_file(modname, destdir) - _freeze_module(modname, pyfile, frozenfile, tmpsuffix) - - -def _freeze_module(frozenid, pyfile, frozenfile, tmpsuffix): - tmpfile = f'{frozenfile}.{int(time.time())}' - - argv = [TOOL, frozenid, pyfile, tmpfile] - print('#', ' '.join(os.path.relpath(a) for a in argv), flush=True) - try: - subprocess.run(argv, check=True) - except (FileNotFoundError, subprocess.CalledProcessError): - if not os.path.exists(TOOL): - sys.exit(f'ERROR: missing {TOOL}; you need to run "make regen-frozen"') - raise # re-raise - - update_file_with_tmpfile(frozenfile, tmpfile, create=True) - - ####################################### # the script @@ -810,15 +720,7 @@ def main(): # Regen build-related files. regen_makefile(modules) regen_pcbuild(modules) - - # Freeze the target modules. - tmpsuffix = f'.{int(time.time())}' - for src in _iter_sources(modules): - _freeze_module(src.frozenid, src.pyfile, src.frozenfile, tmpsuffix) - - # Regen files dependent of frozen file details. regen_frozen(modules) - regen_manifest(modules) if __name__ == '__main__': diff --git a/configure b/configure index a1fc09fc0485455..a1545bf161fb3a2 100755 --- a/configure +++ b/configure @@ -3136,7 +3136,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt -for ac_prog in python$PACKAGE_VERSION python3 python +for ac_prog in python$PACKAGE_VERSION python3.10 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -3177,7 +3177,7 @@ fi test -n "$PYTHON_FOR_REGEN" && break done -test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3" +test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3.10" @@ -3185,7 +3185,7 @@ if test "$cross_compiling" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5 $as_echo_n "checking for python interpreter for cross build... " >&6; } if test -z "$PYTHON_FOR_BUILD"; then - for interp in python$PACKAGE_VERSION python3 python; do + for interp in python$PACKAGE_VERSION python3.10; do which $interp >/dev/null 2>&1 || continue if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info[:2]) == '$PACKAGE_VERSION')"; then break diff --git a/configure.ac b/configure.ac index 5757c3b2586bc3a..a998bddde579ea5 100644 --- a/configure.ac +++ b/configure.ac @@ -96,13 +96,13 @@ AC_SUBST(host) # pybuilddir.txt will be created by --generate-posix-vars in the Makefile rm -f pybuilddir.txt -AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3) +AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3.10, python3.10) AC_SUBST(PYTHON_FOR_REGEN) if test "$cross_compiling" = yes; then AC_MSG_CHECKING([for python interpreter for cross build]) if test -z "$PYTHON_FOR_BUILD"; then - for interp in python$PACKAGE_VERSION python3 python; do + for interp in python$PACKAGE_VERSION python3.10; do which $interp >/dev/null 2>&1 || continue if $interp -c "import sys;sys.exit(not '.'.join(str(n) for n in sys.version_info@<:@:2@:>@) == '$PACKAGE_VERSION')"; then break