]> xenbits.xensource.com Git - xtf.git/commitdiff
build: Use `command -v` in preference to `which`
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sun, 25 Feb 2024 18:00:45 +0000 (18:00 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 30 Aug 2024 18:21:57 +0000 (19:21 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Makefile

index b6e0dd8b4e7b1ff997f8a86c7f87fceef3173b4b..d98a4af83ac688f2bb48715da6819c1e90d52e65 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -50,8 +50,8 @@ INSTALL_DIR     := $(INSTALL) -d -p
 INSTALL_PROGRAM := $(INSTALL) -p
 
 # 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)
+# available.  Fall back to just `python`.
+PYTHON_INTERPRETER := $(word 1,$(shell command -v python3 || command -v python || command -v python2) python)
 PYTHON             ?= $(PYTHON_INTERPRETER)
 
 export CC LD CPP INSTALL INSTALL_DATA INSTALL_DIR INSTALL_PROGRAM OBJCOPY PYTHON