From 207253abc6ec81112abf0a64a8bf68e227528d64 Mon Sep 17 00:00:00 2001 From: Simon John Date: Tue, 4 Aug 2020 23:19:49 +0100 Subject: Rebased python3 branch with some changes from tuna-f1sh@87d5241 --- Common.mk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Common.mk') diff --git a/Common.mk b/Common.mk index 0c1f92c..d4fb9c1 100644 --- a/Common.mk +++ b/Common.mk @@ -98,3 +98,24 @@ ifeq ($(CURRENT_OS),WINDOWS) echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative) endif endif + +######################################################################## +# System Python + +ifndef PYTHON_CMD + # try for Python 3 first + PYTHON_CMD := $(shell which python3 2> /dev/null) + ifdef PYTHON_CMD + $(call show_config_variable,PYTHON_CMD,[AUTODETECTED]) + else + # fall-back to any Python + PYTHON_CMD := $(shell which python 2> /dev/null) + ifdef PYTHON_CMD + $(call show_config_variable,PYTHON_CMD,[AUTODETECTED]) + else + echo $(error "Unable to find system Python! Utility scipts won't work. Override this error by defining PYTHON_CMD") + endif + endif +else + $(call show_config_variable,PYTHON_CMD,[USER]) +endif -- cgit v1.2.3