py-defs.mk, projects.mk: Use latest install Python

Use $(lastword $(shell ls -v /usr/bin/python[0-9]*)) for the Python version to use.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2020-05-16 13:22:51 +00:00
commit caf33841b4
2 changed files with 12 additions and 7 deletions

View file

@ -1,9 +1,11 @@
ENV_PYTHONPATH := $(PYTHONPATH)
ifeq ($(PYTHON),)
PYTHON_VERSION ?= 3
PYTHON ?= /usr/bin/python$(PYTHON_VERSION)
ifneq ($(PYTHON_VERSION),)
PYTHON := /usr/bin/python$(PYTHON_VERSION)
else
ifeq ($(PYTHON),)
PYTHON := $(lastword $(shell ls -v /usr/bin/python[0-9]*))
endif
PYTHON_VERSION ?= $(patsubst python%,%,$(notdir $(PYTHON)))
endif
PYTHON_MAJOR = $(basename $(PYTHON_VERSION))