Makefiles: auto-detect python version - prefer python2

This prepares CRIT for python2/python3 compatibility by auto-detecting
the installed python version. python2 is detected first and then the
variable PYTHON is set.

By setting the variable PYTHON to python2/python3 the user can override
the auto-detection.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Adrian Reber 2018-05-16 06:20:23 +00:00 committed by Pavel Emelyanov
parent 98cb5c627d
commit 1a0ad1ae87
3 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,8 @@ MAKE := make
MKDIR := mkdir -p
AWK := awk
PERL := perl
PYTHON := python
FULL_PYTHON := $(shell which python2 2>/dev/null || which python3 2>/dev/null)
PYTHON ?= $(shell basename $(FULL_PYTHON))
FIND := find
SH := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \