1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

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.
This commit is contained in:
Siddhesh Poyarekar
2016-12-22 23:07:52 +05:30
parent a5ac5676be
commit 8ce8299f94
6 changed files with 109 additions and 18 deletions

24
Rules
View File

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