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.
This commit is contained in:
Victor Stinner 2017-05-03 18:21:48 +02:00 committed by GitHub
parent 13f1f423fa
commit a5c62a8e9f
7 changed files with 87 additions and 261 deletions

View File

@ -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

View File

@ -1142,10 +1142,6 @@ def buildPython():
shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1],
shellQuote(WORKDIR)[1:-1])) shellQuote(WORKDIR)[1:-1]))
# bpo-29550: avoid using make touch until it is fixed for git
# print("Running make touch")
# runCommand("make touch")
print("Running make") print("Running make")
runCommand("make") runCommand("make")

View File

@ -229,7 +229,7 @@ LIBOBJS= @LIBOBJS@
PYTHON= python$(EXE) PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE) BUILDPYTHON= python$(BUILDEXE)
PYTHON_FOR_GEN=@PYTHON_FOR_GEN@ PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
BUILD_GNU_TYPE= @build@ BUILD_GNU_TYPE= @build@
@ -273,11 +273,6 @@ IO_OBJS= \
Modules/_io/stringio.o Modules/_io/stringio.o
########################################################################## ##########################################################################
# Grammar
GRAMMAR_H= Include/graminit.h
GRAMMAR_C= Python/graminit.c
GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
@ -316,38 +311,9 @@ PARSER_HEADERS= \
PGENOBJS= $(POBJS) $(PGOBJS) 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 # Python
OPCODETARGETS_H= \
Python/opcode_targets.h
OPCODETARGETGEN= \
$(srcdir)/Python/makeopcodetargets.py
OPCODETARGETGEN_FILES= \
$(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
PYTHON_OBJS= \ PYTHON_OBJS= \
Python/_warnings.o \ Python/_warnings.o \
Python/Python-ast.o \ Python/Python-ast.o \
@ -548,11 +514,8 @@ coverage-lcov:
@echo "lcov report at $(COVERAGE_REPORT)/index.html" @echo "lcov report at $(COVERAGE_REPORT)/index.html"
@echo @echo
coverage-report: # Force regeneration of parser and importlib
@ # force rebuilding of parser and importlib coverage-report: regen-grammar regen-importlib
@touch $(GRAMMAR_INPUT)
@touch $(srcdir)/Lib/importlib/_bootstrap.py
@touch $(srcdir)/Lib/importlib/_bootstrap_external.py
@ # build with coverage info @ # build with coverage info
$(MAKE) coverage $(MAKE) coverage
@ # run tests, ignore failures @ # run tests, ignore failures
@ -724,15 +687,25 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) 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) $(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 Python/marshal.c .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 \ ./Programs/_freeze_importlib \
$(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h $(srcdir)/Lib/importlib/_bootstrap_external.py \
$(srcdir)/Python/importlib_external.h
Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib Python/marshal.c # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
# using _freeze_importlib
./Programs/_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 # Special rules for object files
@ -790,15 +763,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
$(IO_OBJS): $(IO_H) $(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) $(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) $(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 \ Parser/grammar.o: $(srcdir)/Parser/grammar.c \
$(srcdir)/Include/token.h \ $(srcdir)/Include/token.h \
$(srcdir)/Include/grammar.h $(srcdir)/Include/grammar.h
@ -810,18 +786,28 @@ Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c
Parser/pgenmain.o: $(srcdir)/Include/parsetok.h Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
$(AST_H): $(AST_ASDL) $(ASDLGEN_FILES) .PHONY=regen-ast
$(MKDIR_P) $(AST_H_DIR) regen-ast:
$(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL) # 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
$(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES) .PHONY: regen-opcode
$(MKDIR_P) $(AST_C_DIR) regen-opcode:
$(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) # 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
$(OPCODE_H): $(srcdir)/Lib/opcode.py $(OPCODE_H_SCRIPT) Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
$(OPCODE_H_GEN)
Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
Python/getplatform.o: $(srcdir)/Python/getplatform.c Python/getplatform.o: $(srcdir)/Python/getplatform.c
$(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
@ -871,12 +857,16 @@ Objects/odictobject.o: $(srcdir)/Objects/dict-common.h
Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h $(srcdir)/Objects/dict-common.h Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h $(srcdir)/Objects/dict-common.h
Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES) .PHONY: regen-opcode-targets
$(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H) 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
# Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to # Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
# follow our naming conventions. dtrace(1) uses the output filename to generate # follow our naming conventions. dtrace(1) uses the output filename to generate
@ -891,8 +881,14 @@ Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
$(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS) $(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
Objects/typeobject.o: Objects/typeslots.inc 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 # Header files
@ -945,7 +941,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/node.h \ $(srcdir)/Include/node.h \
$(srcdir)/Include/object.h \ $(srcdir)/Include/object.h \
$(srcdir)/Include/objimpl.h \ $(srcdir)/Include/objimpl.h \
$(OPCODE_H) \ $(srcdir)/Include/opcode.h \
$(srcdir)/Include/osdefs.h \ $(srcdir)/Include/osdefs.h \
$(srcdir)/Include/osmodule.h \ $(srcdir)/Include/osmodule.h \
$(srcdir)/Include/patchlevel.h \ $(srcdir)/Include/patchlevel.h \
@ -988,7 +984,7 @@ PYTHON_HEADERS= \
$(srcdir)/Include/weakrefobject.h \ $(srcdir)/Include/weakrefobject.h \
pyconfig.h \ pyconfig.h \
$(PARSER_HEADERS) \ $(PARSER_HEADERS) \
$(AST_H) \ $(srcdir)/Include/Python-ast.h \
$(DTRACE_HEADERS) $(DTRACE_HEADERS)
$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS) $(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
@ -1555,9 +1551,12 @@ recheck:
$(SHELL) config.status --recheck $(SHELL) config.status --recheck
$(SHELL) config.status $(SHELL) config.status
# Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in # Regenerate configure and pyconfig.h.in
.PHONY: autoconf
autoconf: autoconf:
# Regenerate the configure script from configure.ac using autoconf
(cd $(srcdir); autoconf -Wall) (cd $(srcdir); autoconf -Wall)
# Regenerate pyconfig.h.in from configure.ac using autoheader
(cd $(srcdir); autoheader -Wall) (cd $(srcdir); autoheader -Wall)
# Create a tags file for vi # Create a tags file for vi
@ -1574,14 +1573,6 @@ TAGS::
etags Include/*.h; \ etags Include/*.h; \
for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done 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 # Sanitation targets -- clean leaves libraries, executables and tags
# files, which clobber removes as well # files, which clobber removes as well
pycremoval: pycremoval:
@ -1699,7 +1690,7 @@ Python/thread.o: @THREADHEADERS@
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools .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: smelly funny patchcheck touch altmaninstall commoninstall
.PHONY: gdbhooks .PHONY: gdbhooks

View File

@ -1026,6 +1026,10 @@ Documentation
Build 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. - bpo-29643: Fix ``--enable-optimization`` didn't work.
- bpo-27593: sys.version and the platform module python_build(), - bpo-27593: sys.version and the platform module python_build(),

View File

@ -1,129 +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.
"""
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]")
}

32
configure vendored
View File

@ -749,9 +749,8 @@ UNIVERSALSDK
CONFIG_ARGS CONFIG_ARGS
SOVERSION SOVERSION
VERSION VERSION
GENERATED_COMMENT
PYTHON_FOR_BUILD PYTHON_FOR_BUILD
PYTHON_FOR_GEN PYTHON_FOR_REGEN
host_os host_os
host_vendor host_vendor
host_cpu host_cpu
@ -2880,11 +2879,11 @@ do
set dummy $ac_prog; ac_word=$2 set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $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 $as_echo_n "(cached) " >&6
else else
if test -n "$PYTHON_FOR_GEN"; then if test -n "$PYTHON_FOR_REGEN"; then
ac_cv_prog_PYTHON_FOR_GEN="$PYTHON_FOR_GEN" # Let the user override the test. ac_cv_prog_PYTHON_FOR_REGEN="$PYTHON_FOR_REGEN" # Let the user override the test.
else else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH for as_dir in $PATH
@ -2893,7 +2892,7 @@ do
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 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 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2 break 2
fi fi
@ -2903,25 +2902,20 @@ IFS=$as_save_IFS
fi fi
fi fi
PYTHON_FOR_GEN=$ac_cv_prog_PYTHON_FOR_GEN PYTHON_FOR_REGEN=$ac_cv_prog_PYTHON_FOR_REGEN
if test -n "$PYTHON_FOR_GEN"; then if test -n "$PYTHON_FOR_REGEN"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_GEN" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_FOR_REGEN" >&5
$as_echo "$PYTHON_FOR_GEN" >&6; } $as_echo "$PYTHON_FOR_REGEN" >&6; }
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi fi
test -n "$PYTHON_FOR_GEN" && break test -n "$PYTHON_FOR_REGEN" && break
done 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 if test "$cross_compiling" = yes; then
@ -2942,18 +2936,14 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
$as_echo "$interp" >&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 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$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 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
fi fi
# Used to comment out stuff for rebuilding generated files
GENERATED_COMMENT='#'
elif test "$cross_compiling" = maybe; then elif test "$cross_compiling" = maybe; then
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
else else
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
GENERATED_COMMENT=''
fi fi
if test "$prefix" != "/"; then if test "$prefix" != "/"; then
prefix=`echo "$prefix" | sed -e 's/\/$//g'` prefix=`echo "$prefix" | sed -e 's/\/$//g'`
fi fi

View File

@ -56,13 +56,8 @@ AC_SUBST(host)
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
rm -f pybuilddir.txt rm -f pybuilddir.txt
AC_CHECK_PROGS(PYTHON_FOR_GEN, python$PACKAGE_VERSION python3 python, not-found) AC_CHECK_PROGS(PYTHON_FOR_REGEN, python$PACKAGE_VERSION python3 python, python3)
if test "$PYTHON_FOR_GEN" = not-found; then AC_SUBST(PYTHON_FOR_REGEN)
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)
if test "$cross_compiling" = yes; then if test "$cross_compiling" = yes; then
AC_MSG_CHECKING([for python interpreter for cross build]) AC_MSG_CHECKING([for python interpreter for cross build])
@ -80,16 +75,12 @@ if test "$cross_compiling" = yes; then
AC_MSG_RESULT($interp) 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 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$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 _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp
fi fi
# Used to comment out stuff for rebuilding generated files
GENERATED_COMMENT='#'
elif test "$cross_compiling" = maybe; then elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
else else
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
GENERATED_COMMENT=''
fi fi
AC_SUBST(PYTHON_FOR_BUILD) 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 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 dnl it does, we get path names containing '//' which is both ugly and