about summary refs log tree commit diff
path: root/Rules
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2016-12-22 23:07:52 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2016-12-22 23:07:52 +0530
commit8ce8299f9458c7fee8554ecd4b97cc5eddba4e4c (patch)
tree20532b2c52c1cfd50168be19d396acf12ee89a23 /Rules
parenta5ac5676be7b987edfbf800f577dab487fd85e5f (diff)
downloadglibc-8ce8299f9458c7fee8554ecd4b97cc5eddba4e4c.tar.gz
glibc-8ce8299f9458c7fee8554ecd4b97cc5eddba4e4c.tar.xz
glibc-8ce8299f9458c7fee8554ecd4b97cc5eddba4e4c.zip
Add configure check for python program
Add a configure check that looks for python3 and python in that order
since we had agreed in the past to prefer python3 over python in all
our code.  The patch also adjusts invocations through the various
Makefiles to use the set variable.

	* configure.ac: Check for python3 or python.
	* configure: Regenerated.
	* config.make.in (PYTHON): New variable.
	* benchtests/Makefile: Don't define PYTHON.
	(bench): Define target only if PYTHON was defined.
	* Rules: Don't define PYTHON.
	Define pretty printer targets only if PYTHON was defined.
	(tests-printers): Add to tests-unsupported if PYTHON is not
	found.
	(python-flags, python-invoke): Remove.
	(tests-printers-out): Use PYTHON instead of python-invoke.
Diffstat (limited to 'Rules')
-rw-r--r--Rules24
1 files changed, 11 insertions, 13 deletions
diff --git a/Rules b/Rules
index fe18ce55de..558924d653 100644
--- a/Rules
+++ b/Rules
@@ -114,6 +114,11 @@ tests-printers-programs := $(addprefix $(objpfx),$(tests-printers))
 # .out files with the output of running the pretty printer tests.
 tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers))
 
+ifndef PYTHON
+# Mark tests-printers tests as unsupported if we don't have PYTHON.
+tests-unsupported += $(tests-printers)
+endif
+
 ifeq ($(build-programs),yes)
 others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
 else
@@ -124,9 +129,9 @@ endif
 others: $(py-const)
 
 ifeq ($(run-built-tests),no)
-tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \
-			     $(test-srcs)) $(tests-special) \
-       $(tests-printers-programs)
+tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests) \
+			       $(tests-printers-programs)) \
+			     $(test-srcs)) $(tests-special)
 xtests: tests $(xtests-special)
 else
 tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out)
@@ -255,16 +260,8 @@ endif
 
 endif	# tests
 
+ifdef PYTHON
 ifneq "$(strip $(tests-printers))" ""
-# We're defining this here for now; later it'll be defined at configure time
-# inside Makeconfig.
-PYTHON := python
-
-# Invoke Python using -B to avoid generating .pyc files on the source dir,
-# so that we can keep it read-only.
-python-flags := -B
-
-python-invoke := $(PYTHON) $(python-flags)
 
 # Static pattern rule for building the test programs for the pretty printers.
 $(tests-printers-programs): %: %.o $(tests-printers-libs) \
@@ -283,9 +280,10 @@ py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH}
 $(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \
 		       $(..)scripts/test_printers_common.py
 	$(test-wrapper-env) $(py-env) \
-	    $(python-invoke) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
+	    $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
 	$(evaluate-test)
 endif
+endif
 
 
 .PHONY: distclean realclean subdir_distclean subdir_realclean \