From c8a8645f1efe967f7d50e224cffe8282ec7df640 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Sat, 7 Dec 2019 15:50:22 +0000 Subject: [PATCH] xen/build: Automatically locate a suitable python interpreter Needing to pass PYTHON=python3 into hypervisor builds is irritating and unnecessary. Locate a suitable interpreter automatically, defaulting to Py3 if it is available. Reported-by: Steven Haigh Signed-off-by: Andrew Cooper Acked-by: George Dunlap Release-acked-by: Juergen Gross --- xen/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/Makefile b/xen/Makefile index 949ca6eb03..f36a5bc6c0 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -13,6 +13,11 @@ export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) export XEN_BUILD_HOST ?= $(shell hostname) export XEN_CONFIG_EXPERT ?= n +# Best effort attempt to find a python interpreter, defaulting to Python 3 if +# available. Fall back to just `python` if `which` is nowhere to be found. +PYTHON_INTERPRETER := $(word 1,$(shell which python3 python python2 2>/dev/null) python) +export PYTHON ?= $(PYTHON_INTERPRETER) + export BASEDIR := $(CURDIR) export XEN_ROOT := $(BASEDIR)/.. -- 2.30.2