Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Mac/BuildScript/build-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
104 changes: 46 additions & 58 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)

PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
HOST_GNU_TYPE= @host@
Expand Down Expand Up @@ -233,11 +234,6 @@ SIGNAL_OBJS= @SIGNAL_OBJS@


##########################################################################
# Grammar
GRAMMAR_H= Include/graminit.h
GRAMMAR_C= Python/graminit.c
GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar


LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@

Expand Down Expand Up @@ -297,29 +293,6 @@ PGENSRCS= $(PSRCS) $(PGSRCS)
PGENOBJS= $(POBJS) $(PGOBJS)

##########################################################################
# 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
# XXX Note that a build now requires Python exist before the build starts
ASDLGEN= $(srcdir)/Parser/asdl_c.py

##########################################################################
# Python

OPCODETARGETS_H= \
$(srcdir)/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 \
Expand Down Expand Up @@ -493,9 +466,8 @@ coverage-lcov:
@echo "lcov report at $(COVERAGE_REPORT)/index.html"
@echo

coverage-report:
: # force rebuilding of parser
@touch $(GRAMMAR_INPUT)
# Force regeneration of parser
coverage-report: regen-grammar
: # build with coverage info
$(MAKE) coverage
: # run tests, ignore failures
Expand Down Expand Up @@ -644,6 +616,12 @@ Modules/Setup: $(srcdir)/Modules/Setup.dist
echo "-----------------------------------------------"; \
fi


############################################################################
# Regenerate all generated files

regen-all: regen-opcode-targets regen-grammar regen-ast

############################################################################
# Special rules for object files

Expand Down Expand Up @@ -677,15 +655,18 @@ Modules/grpmodule.o: $(srcdir)/Modules/grpmodule.c $(srcdir)/Modules/posixmodule

Modules/pwdmodule.o: $(srcdir)/Modules/pwdmodule.c $(srcdir)/Modules/posixmodule.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) $(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
Expand All @@ -695,15 +676,20 @@ Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.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_ASDL) $(ASDLGEN_FILES)
$(MKDIR_P) $(AST_C_DIR)
$(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)

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

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_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
Expand Down Expand Up @@ -738,10 +724,14 @@ Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c \
Objects/stringobject.o: $(srcdir)/Objects/stringobject.c \
$(STRINGLIB_HEADERS)

$(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
$(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)
Python/ceval.o: $(srcdir)/Python/opcode_targets.h

Python/formatter_unicode.o: $(srcdir)/Python/formatter_unicode.c \
$(STRINGLIB_HEADERS)
Expand Down Expand Up @@ -836,7 +826,7 @@ PYTHON_HEADERS= \
Include/weakrefobject.h \
pyconfig.h \
$(PARSER_HEADERS) \
$(AST_H)
$(srcdir)/Include/Python-ast.h

$(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)

Expand Down Expand Up @@ -1356,9 +1346,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)
# Regenerate pyconfig.h.in from configure.ac using autoheader
(cd $(srcdir); autoheader)

# Create a tags file for vi
Expand All @@ -1375,11 +1368,6 @@ TAGS::
etags Include/*.h; \
for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done

# Touch generated files
touch:
cd $(srcdir); \
touch Include/Python-ast.h Python/Python-ast.c

# Sanitation targets -- clean leaves libraries, executables and tags
# files, which clobber removes as well
pycremoval:
Expand Down Expand Up @@ -1476,8 +1464,8 @@ 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: smelly funny patchcheck touch altmaninstall commoninstall
.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
.PHONY: smelly funny patchcheck altmaninstall commoninstall
.PHONY: gdbhooks

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
4 changes: 4 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,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-27593: sys.version and the platform module python_build(),
python_branch(), and python_revision() functions now use
git information rather than hg when building from a repo.
Expand Down
53 changes: 47 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@ UNIVERSALSDK
CONFIG_ARGS
SOVERSION
VERSION
GENERATED_COMMENT
PYTHON_FOR_BUILD
PYTHON_FOR_REGEN
host_os
host_vendor
host_cpu
Expand Down Expand Up @@ -2902,6 +2902,51 @@ 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
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
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_REGEN+:} false; then :
$as_echo_n "(cached) " >&6
else
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
do
IFS=$as_save_IFS
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_REGEN="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

fi
fi
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_REGEN" && break
done
test -n "$PYTHON_FOR_REGEN" || PYTHON_FOR_REGEN="python3"



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; }
Expand All @@ -2918,20 +2963,16 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
$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
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
# 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
Expand Down
7 changes: 3 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ 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_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
Expand All @@ -35,16 +38,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
Expand Down