diff --git a/Makefile b/Makefile index 29d388d2..d448cd4c 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ endif LD := ld NM := nm -PYTHON := python +PYTHON := $(shell tools/ci/get-python.sh) SHELL := bash RM := rm LN := ln diff --git a/tools/ci/get-python.sh b/tools/ci/get-python.sh new file mode 100755 index 00000000..4aa8927c --- /dev/null +++ b/tools/ci/get-python.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Not all systems ship a 'python' wrapper, try version specific ones if we +# fail to find the version-agnostic one. +# +# Copyright (c) 2023 Open Source Security, Inc. + +try_python() { + if $1 -c 'exit' 2>/dev/null; then + echo "$1" + exit 0 + fi +} + +try_python python +try_python python3 +try_python python2 + +echo "error: python interpreter not found!" >&2 +exit 1