aboutsummaryrefslogtreecommitdiff
path: root/Common.mk
diff options
context:
space:
mode:
authorSimon John <git@the-jedi.co.uk>2020-08-04 23:19:49 +0100
committerSimon John <git@the-jedi.co.uk>2020-08-04 23:19:49 +0100
commit207253abc6ec81112abf0a64a8bf68e227528d64 (patch)
treeb289b1a3ad4d2793e38e5072353b9f5484f98a7b /Common.mk
parent6f786a96b0acfb0c9b2d2f4e39911d2803088729 (diff)
Rebased python3 branch with some changes from tuna-f1sh@87d5241
Diffstat (limited to 'Common.mk')
-rw-r--r--Common.mk21
1 files changed, 21 insertions, 0 deletions
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