]> granicus.if.org Git - python/commitdiff
bpo-23404: make touch becomes make regen-all (#1405) (#1461) (#1465)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 5 May 2017 00:19:59 +0000 (02:19 +0200)
committerGitHub <noreply@github.com>
Fri, 5 May 2017 00:19:59 +0000 (02:19 +0200)
* bpo-23404: make touch becomes make regen-all (#1405)

Don't rebuild generated files based on file modification time
anymore, the action is now explicit. Replace "make touch"
with "make regen-all".

Changes:

* Remove "make touch", Tools/hg/hgtouch.py and .hgtouch
* Add a new "make regen-all" command to rebuild all generated files
* Add subcommands to only generate specific files:

  - regen-ast: Include/Python-ast.h and Python/Python-ast.c
  - regen-grammar: Include/graminit.h and Python/graminit.c
  - regen-importlib: Python/importlib_external.h and Python/importlib.h
  - regen-opcode: Include/opcode.h
  - regen-opcode-targets: Python/opcode_targets.h
  - regen-typeslots: Objects/typeslots.inc

* Rename PYTHON_FOR_GEN to PYTHON_FOR_REGEN
* pgen is now only built by by "make regen-grammar"
* Add $(srcdir)/ prefix to paths to source files to handle correctly
  compilation outside the source directory

Note: $(PYTHON_FOR_REGEN) is no more used nor needed by "make"
default target building Python.
(cherry picked from commit a5c62a8e9f0de6c4133825a5710984a3cd5e102b)

* bpo-30273: Update sysconfig (#1464)

The AST_H_DIR variable was removed from Makefile.pre.in by the commit
a5c62a8e9f0de6c4133825a5710984a3cd5e102b (bpo-23404).

AST_H_DIR was hardcoded to "Include", so replace the removed variable
by its content.

Remove also ASDLGEN variable from sysconfig example since this
variable was also removed.
(cherry picked from commit b109a1d3360fc4bb87b9887264e3634632d392ca)

(cherry picked from commit 9d02f562961efd12d3c8317a10916db7f77330cc)

.hgtouch [deleted file]
Doc/library/sysconfig.rst
Lib/distutils/sysconfig.py
Mac/BuildScript/build-installer.py
Makefile.pre.in
Misc/NEWS
Tools/hg/hgtouch.py [deleted file]
configure
configure.ac

diff --git a/.hgtouch b/.hgtouch
deleted file mode 100644 (file)
index b9be0f1..0000000
--- a/.hgtouch
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- Makefile -*-
-# Define dependencies of generated files that are checked into hg.
-# The syntax of this file uses make rule dependencies, without actions
-
-Python/importlib.h: Lib/importlib/_bootstrap.py Programs/_freeze_importlib.c
-
-Include/opcode.h:  Lib/opcode.py Tools/scripts/generate_opcode_h.py
-
-Include/Python-ast.h: Parser/Python.asdl Parser/asdl.py Parser/asdl_c.py
-Python/Python-ast.c: Include/Python-ast.h
-
-Python/opcode_targets.h: Python/makeopcodetargets.py Lib/opcode.py
-
-Objects/typeslots.inc: Include/typeslots.h Objects/typeslots.py
-
-Include/graminit.h: Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c
-Python/graminit.c: Include/graminit.h Grammar/Grammar Parser/acceler.c Parser/grammar1.c Parser/listnode.c Parser/node.c Parser/parser.c Parser/bitset.c Parser/metagrammar.c Parser/firstsets.c Parser/grammar.c Parser/pgen.c Objects/obmalloc.c Python/dynamic_annotations.c Python/mysnprintf.c Python/pyctype.c Parser/tokenizer_pgen.c Parser/printgrammar.c Parser/parsetok_pgen.c Parser/pgenmain.c
index 02aaab3cf26f5efbfaac792699371da106aaac4a..4cbe23966bf1e829936cf00a5a8dd6079c4136d3 100644 (file)
@@ -255,7 +255,6 @@ You can use :mod:`sysconfig` as a script with Python's *-m* option:
             AIX_GENUINE_CPLUSPLUS = "0"
             AR = "ar"
             ARFLAGS = "rc"
-            ASDLGEN = "./Parser/asdl_c.py"
             ...
 
 This call will print in the standard output the information returned by
index 573724ddd778d191f56eaadbcc3de822d89deae2..4f321352151d56437c9959f00e3702d2e92c1635 100644 (file)
@@ -97,7 +97,7 @@ def get_python_inc(plat_specific=0, prefix=None):
             if plat_specific:
                 return base
             if _sys_home:
-                incdir = os.path.join(_sys_home, get_config_var('AST_H_DIR'))
+                incdir = os.path.join(_sys_home, 'Include')
             else:
                 incdir = os.path.join(get_config_var('srcdir'), 'Include')
             return os.path.normpath(incdir)
index c76c4f1a269708ae19cb498f5818bafef50c9900..fb112741e05a004d6cecef961c9f156578fa683f 100755 (executable)
@@ -1168,9 +1168,6 @@ def buildPython():
         shellQuote(WORKDIR)[1:-1],
         shellQuote(WORKDIR)[1:-1]))
 
-    print("Running make touch")
-    runCommand("make touch")
-
     print("Running make")
     runCommand("make")
 
index f0450effad0f5add64acaa24e4563f4ef07b822a..04ef1a12019c15883cd6b316f8579430c0fd1f9d 100644 (file)
@@ -224,7 +224,7 @@ LIBOBJS=    @LIBOBJS@
 PYTHON=                python$(EXE)
 BUILDPYTHON=   python$(BUILDEXE)
 
-PYTHON_FOR_GEN=@PYTHON_FOR_GEN@
+PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
 PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
 _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
 BUILD_GNU_TYPE=        @build@
@@ -271,11 +271,6 @@ IO_OBJS=   \
                Modules/_io/stringio.o
 
 ##########################################################################
-# Grammar
-GRAMMAR_H=     Include/graminit.h
-GRAMMAR_C=     Python/graminit.c
-GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
-
 
 LIBFFI_INCLUDEDIR=     @LIBFFI_INCLUDEDIR@
 
@@ -337,38 +332,9 @@ PARSER_HEADERS= \
 PGENSRCS=      $(PSRCS) $(PGSRCS)
 PGENOBJS=      $(POBJS) $(PGOBJS)
 
-##########################################################################
-# opcode.h generation
-OPCODE_H_DIR=  $(srcdir)/Include
-OPCODE_H_SCRIPT= $(srcdir)/Tools/scripts/generate_opcode_h.py
-OPCODE_H=      $(OPCODE_H_DIR)/opcode.h
-OPCODE_H_GEN=  $(PYTHON_FOR_GEN) $(OPCODE_H_SCRIPT) $(srcdir)/Lib/opcode.py $(OPCODE_H)
-#
-##########################################################################
-# AST
-AST_H_DIR=     Include
-AST_H=         $(AST_H_DIR)/Python-ast.h
-AST_C_DIR=     Python
-AST_C=         $(AST_C_DIR)/Python-ast.c
-AST_ASDL=      $(srcdir)/Parser/Python.asdl
-
-ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
-# Note that a build now requires Python to exist before the build starts.
-# Use "hg touch" to fix up screwed up file mtimes in a checkout.
-ASDLGEN=       $(PYTHON_FOR_GEN) $(srcdir)/Parser/asdl_c.py
-
 ##########################################################################
 # Python
 
-OPCODETARGETS_H= \
-               Python/opcode_targets.h
-
-OPCODETARGETGEN= \
-               $(srcdir)/Python/makeopcodetargets.py
-
-OPCODETARGETGEN_FILES= \
-               $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
-
 PYTHON_OBJS=   \
                Python/_warnings.o \
                Python/Python-ast.o \
@@ -551,7 +517,8 @@ coverage-lcov:
        @echo "lcov report at $(COVERAGE_REPORT)/index.html"
        @echo
 
-coverage-report:
+# Force regeneration of parser and importlib
+coverage-report: regen-grammar regen-importlib
        : # force rebuilding of parser and importlib
        @touch $(GRAMMAR_INPUT)
        @touch $(srcdir)/Lib/importlib/_bootstrap.py
@@ -721,14 +688,24 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
 Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
        $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
 
-Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib
+.PHONY: regen-importlib
+regen-importlib: Programs/_freeze_importlib
+       # Regenerate Python/importlib_external.h
+       # from Lib/importlib/_bootstrap_external.py using _freeze_importlib
        ./Programs/_freeze_importlib \
-           $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
-
-Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib
+           $(srcdir)/Lib/importlib/_bootstrap_external.py \
+           $(srcdir)/Python/importlib_external.h
+       # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
+       # using _freeze_importlib
        ./Programs/_freeze_importlib \
-           $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
+           $(srcdir)/Lib/importlib/_bootstrap.py \
+           $(srcdir)/Python/importlib.h
+
+
+############################################################################
+# Regenerate all generated files
 
+regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-ast regen-importlib
 
 ############################################################################
 # Special rules for object files
@@ -787,15 +764,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
 
 $(IO_OBJS): $(IO_H)
 
-$(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
-       @$(MKDIR_P) Include
-       $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-$(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
-       touch $(GRAMMAR_C)
-
 $(PGEN): $(PGENOBJS)
                $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
 
+.PHONY: regen-grammar
+regen-grammar: $(PGEN)
+       # Regenerate Include/graminit.h and Python/graminit.c
+       # from Grammar/Grammar using pgen
+       @$(MKDIR_P) Include
+       $(PGEN) $(srcdir)/Grammar/Grammar \
+               $(srcdir)/Include/graminit.h \
+               $(srcdir)/Python/graminit.c
+
 Parser/grammar.o:      $(srcdir)/Parser/grammar.c \
                                $(srcdir)/Include/token.h \
                                $(srcdir)/Include/grammar.h
@@ -807,18 +787,28 @@ Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c
 
 Parser/pgenmain.o:     $(srcdir)/Include/parsetok.h
 
-$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
-       $(MKDIR_P) $(AST_H_DIR)
-       $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
-
-$(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES)
-       $(MKDIR_P) $(AST_C_DIR)
-       $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
-
-$(OPCODE_H): $(srcdir)/Lib/opcode.py $(OPCODE_H_SCRIPT)
-       $(OPCODE_H_GEN)
-
-Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
+.PHONY=regen-ast
+regen-ast:
+       # Regenerate Include/Python-ast.h using Parser/asdl_c.py -h
+       $(MKDIR_P) $(srcdir)/Include
+       $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
+               -h $(srcdir)/Include \
+               $(srcdir)/Parser/Python.asdl
+       # Regenerate Python/Python-ast.c using Parser/asdl_c.py -c
+       $(MKDIR_P) $(srcdir)/Python
+       $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
+               -c $(srcdir)/Python \
+               $(srcdir)/Parser/Python.asdl
+
+.PHONY: regen-opcode
+regen-opcode:
+       # Regenerate Include/opcode.h from Lib/opcode.py
+       # using Tools/scripts/generate_opcode_h.py
+       $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \
+               $(srcdir)/Lib/opcode.py \
+               $(srcdir)/Include/opcode.h
+
+Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
                $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
@@ -867,16 +857,26 @@ Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS)
 Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h
 Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
 
-$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
-       $(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H)
+.PHONY: regen-opcode-targets
+regen-opcode-targets:
+       # Regenerate Python/opcode_targets.h from Lib/opcode.py
+       # using Python/makeopcodetargets.py
+       $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
+               $(srcdir)/Python/opcode_targets.h
 
-Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
+Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h
 
-Python/frozen.o: Python/importlib.h Python/importlib_external.h
+Python/frozen.o: $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib_external.h
 
 Objects/typeobject.o: Objects/typeslots.inc
-Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
-       $(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc
+
+.PHONY: regen-typeslots
+regen-typeslots:
+       # Regenerate Objects/typeslots.inc from Include/typeslotsh
+       # using Objects/typeslots.py
+       $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \
+               < $(srcdir)/Include/typeslots.h \
+               $(srcdir)/Objects/typeslots.inc
 
 ############################################################################
 # Header files
@@ -929,7 +929,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/node.h \
                $(srcdir)/Include/object.h \
                $(srcdir)/Include/objimpl.h \
-               $(OPCODE_H) \
+               $(srcdir)/Include/opcode.h \
                $(srcdir)/Include/osdefs.h \
                $(srcdir)/Include/patchlevel.h \
                $(srcdir)/Include/pgen.h \
@@ -970,7 +970,7 @@ PYTHON_HEADERS= \
                $(srcdir)/Include/weakrefobject.h \
                pyconfig.h \
                $(PARSER_HEADERS) \
-               $(AST_H)
+               $(srcdir)/Include/Python-ast.h
 
 $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
 
@@ -1551,9 +1551,12 @@ recheck:
        $(SHELL) config.status --recheck
        $(SHELL) config.status
 
-# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
+# Regenerate configure and pyconfig.h.in
+.PHONY: autoconf
 autoconf:
+       # Regenerate the configure script from configure.ac using autoconf
        (cd $(srcdir); autoconf -Wall)
+       # Regenerate pyconfig.h.in from configure.ac using autoheader
        (cd $(srcdir); autoheader -Wall)
 
 # Create a tags file for vi
@@ -1570,14 +1573,6 @@ TAGS::
        etags Include/*.h; \
        for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
 
-# This fixes up the mtimes of checked-in generated files, assuming that they
-# only *appear* to be outdated because of checkout order.
-# This is run while preparing a source release tarball, and can be run manually
-# to avoid bootstrap issues.
-touch:
-       cd $(srcdir); \
-       hg --config extensions.touch=Tools/hg/hgtouch.py touch -v
-
 # Sanitation targets -- clean leaves libraries, executables and tags
 # files, which clobber removes as well
 pycremoval:
@@ -1695,7 +1690,7 @@ Python/thread.o: @THREADHEADERS@
 .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
 .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
 .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
-.PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
+.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
 .PHONY: smelly funny patchcheck touch altmaninstall commoninstall
 .PHONY: gdbhooks
 
index 1852d687f7393a4f607ffdd02e360925b0ee9bb1..8a42a23989fff66dd1c3d797c20fcc024425cdd1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -203,6 +203,10 @@ Documentation
 Build
 -----
 
+- bpo-23404: Don't regenerate generated files based on file modification time
+  anymore: the action is now explicit. Replace ``make touch`` with
+  ``make regen-all``.
+
 - bpo-29643: Fix ``--enable-optimization`` didn't work.
 
 Tests
diff --git a/Tools/hg/hgtouch.py b/Tools/hg/hgtouch.py
deleted file mode 100644 (file)
index 119d812..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-"""Bring time stamps of generated checked-in files into the right order
-
-A versioned configuration file .hgtouch specifies generated files, in the
-syntax of make rules.
-
-  output:    input1 input2
-
-In addition to the dependency syntax, #-comments are supported.
-"""
-from __future__ import with_statement
-import errno
-import os
-import time
-
-def parse_config(repo):
-    try:
-        fp = repo.wfile(".hgtouch")
-    except IOError, e:
-        if e.errno != errno.ENOENT:
-            raise
-        return {}
-    result = {}
-    with fp:
-        for line in fp:
-            # strip comments
-            line = line.split('#')[0].strip()
-            if ':' not in line:
-                continue
-            outputs, inputs = line.split(':', 1)
-            outputs = outputs.split()
-            inputs = inputs.split()
-            for o in outputs:
-                try:
-                    result[o].extend(inputs)
-                except KeyError:
-                    result[o] = inputs
-    return result
-
-def check_rule(ui, repo, modified, basedir, output, inputs):
-    """Verify that the output is newer than any of the inputs.
-    Return (status, stamp), where status is True if the update succeeded,
-    and stamp is the newest time stamp assigned  to any file (might be in
-    the future).
-
-    If basedir is nonempty, it gives a directory in which the tree is to
-    be checked.
-    """
-    f_output = repo.wjoin(os.path.join(basedir, output))
-    try:
-        o_time = os.stat(f_output).st_mtime
-    except OSError:
-        ui.warn("Generated file %s does not exist\n" % output)
-        return False, 0
-    youngest = 0   # youngest dependency
-    backdate = None
-    backdate_source = None
-    for i in inputs:
-        f_i = repo.wjoin(os.path.join(basedir, i))
-        try:
-            i_time = os.stat(f_i).st_mtime
-        except OSError:
-            ui.warn(".hgtouch input file %s does not exist\n" % i)
-            return False, 0
-        if i in modified:
-            # input is modified. Need to backdate at least to i_time
-            if backdate is None or backdate > i_time:
-                backdate = i_time
-                backdate_source = i
-            continue
-        youngest = max(i_time, youngest)
-    if backdate is not None:
-        ui.warn("Input %s for file %s locally modified\n" % (backdate_source, output))
-        # set to 1s before oldest modified input
-        backdate -= 1
-        os.utime(f_output, (backdate, backdate))
-        return False, 0
-    if youngest >= o_time:
-        ui.note("Touching %s\n" % output)
-        youngest += 1
-        os.utime(f_output, (youngest, youngest))
-        return True, youngest
-    else:
-        # Nothing to update
-        return True, 0
-
-def do_touch(ui, repo, basedir):
-    if basedir:
-        if not os.path.isdir(repo.wjoin(basedir)):
-            ui.warn("Abort: basedir %r does not exist\n" % basedir)
-            return
-        modified = []
-    else:
-        modified = repo.status()[0]
-    dependencies = parse_config(repo)
-    success = True
-    tstamp = 0       # newest time stamp assigned
-    # try processing all rules in topological order
-    hold_back = {}
-    while dependencies:
-        output, inputs = dependencies.popitem()
-        # check whether any of the inputs is generated
-        for i in inputs:
-            if i in dependencies:
-                hold_back[output] = inputs
-                continue
-        _success, _tstamp = check_rule(ui, repo, modified, basedir, output, inputs)
-        success = success and _success
-        tstamp = max(tstamp, _tstamp)
-        # put back held back rules
-        dependencies.update(hold_back)
-        hold_back = {}
-    now = time.time()
-    if tstamp > now:
-        # wait until real time has passed the newest time stamp, to
-        # avoid having files dated in the future
-        time.sleep(tstamp-now)
-    if hold_back:
-        ui.warn("Cyclic dependency involving %s\n" % (' '.join(hold_back.keys())))
-        return False
-    return success
-
-def touch(ui, repo, basedir):
-    "touch generated files that are older than their sources after an update."
-    do_touch(ui, repo, basedir)
-
-cmdtable = {
-    "touch": (touch,
-              [('b', 'basedir', '', 'base dir of the tree to apply touching')],
-              "hg touch [-b BASEDIR]")
-}
index a6d83f266008c9e9c1d80e7b958c15a275446aeb..2091da7fb1bd51d21430c63ced1706cc1644efb9 100755 (executable)
--- a/configure
+++ b/configure
@@ -747,9 +747,8 @@ UNIVERSALSDK
 CONFIG_ARGS
 SOVERSION
 VERSION
-GENERATED_COMMENT
 PYTHON_FOR_BUILD
-PYTHON_FOR_GEN
+PYTHON_FOR_REGEN
 host_os
 host_vendor
 host_cpu
@@ -3010,11 +3009,11 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_PYTHON_FOR_GEN+:} false; then :
+if ${ac_cv_prog_PYTHON_FOR_REGEN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$PYTHON_FOR_GEN"; then
-  ac_cv_prog_PYTHON_FOR_GEN="$PYTHON_FOR_GEN" # Let the user override the test.
+  if test -n "$PYTHON_FOR_REGEN"; then
+  ac_cv_prog_PYTHON_FOR_REGEN="$PYTHON_FOR_REGEN" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -3023,7 +3022,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_PYTHON_FOR_GEN="$ac_prog"
+    ac_cv_prog_PYTHON_FOR_REGEN="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -3033,25 +3032,20 @@ IFS=$as_save_IFS
 
 fi
 fi
-PYTHON_FOR_GEN=$ac_cv_prog_PYTHON_FOR_GEN
-if test -n "$PYTHON_FOR_GEN"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_GEN" >&5
-$as_echo "$PYTHON_FOR_GEN" >&6; }
+PYTHON_FOR_REGEN=$ac_cv_prog_PYTHON_FOR_REGEN
+if test -n "$PYTHON_FOR_REGEN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_REGEN" >&5
+$as_echo "$PYTHON_FOR_REGEN" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-  test -n "$PYTHON_FOR_GEN" && break
+  test -n "$PYTHON_FOR_REGEN" && break
 done
-test -n "$PYTHON_FOR_GEN" || PYTHON_FOR_GEN="not-found"
+test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3"
 
-if test "$PYTHON_FOR_GEN" = not-found; then
-    PYTHON_FOR_GEN='@echo "Cannot generate $@, python not found !" && \
-    echo "To skip re-generation of $@ run <make touch> or <make -t $@>." && \
-    echo "Otherwise, set python in PATH and run configure or run <make PYTHON_FOR_GEN=python>." && false &&'
-fi
 
 
 if test "$cross_compiling" = yes; then
@@ -3072,18 +3066,14 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
 $as_echo "$interp" >&6; }
        PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
     fi
-    # Used to comment out stuff for rebuilding generated files
-    GENERATED_COMMENT='#'
 elif test "$cross_compiling" = maybe; then
     as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
 else
     PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
-    GENERATED_COMMENT=''
 fi
 
 
 
-
 if test "$prefix" != "/"; then
     prefix=`echo "$prefix" | sed -e 's/\/$//g'`
 fi
index 22ac805a66a3f66dfc62feaa2fc180c21c2e0dfb..e1731dbc2220781143d73c3355857dba645aa5e4 100644 (file)
@@ -56,13 +56,8 @@ AC_SUBST(host)
 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
 rm -f pybuilddir.txt
 
-AC_CHECK_PROGS(PYTHON_FOR_GEN, python$PACKAGE_VERSION python3 python, not-found)
-if test "$PYTHON_FOR_GEN" = not-found; then
-    PYTHON_FOR_GEN='@echo "Cannot generate $@, python not found !" && \
-    echo "To skip re-generation of $@ run <make touch> or <make -t $@>." && \
-    echo "Otherwise, set python in PATH and run configure or run <make PYTHON_FOR_GEN=python>." && false &&'
-fi
-AC_SUBST(PYTHON_FOR_GEN)
+AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3)
+AC_SUBST(PYTHON_FOR_REGEN)
 
 if test "$cross_compiling" = yes; then
     AC_MSG_CHECKING([for python interpreter for cross build])
@@ -80,16 +75,12 @@ if test "$cross_compiling" = yes; then
         AC_MSG_RESULT($interp)
        PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
     fi
-    # Used to comment out stuff for rebuilding generated files
-    GENERATED_COMMENT='#'
 elif test "$cross_compiling" = maybe; then
     AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
 else
     PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
-    GENERATED_COMMENT=''
 fi
 AC_SUBST(PYTHON_FOR_BUILD)
-AC_SUBST(GENERATED_COMMENT)
 
 dnl Ensure that if prefix is specified, it does not end in a slash. If
 dnl it does, we get path names containing '//' which is both ugly and