From: Maxim Belkin Date: Thu, 5 Dec 2019 16:46:38 +0000 (-0600) Subject: Makefile: detect Python 3 X-Git-Url: https://git.arvados.org/rnaseq-cwl-training.git/commitdiff_plain/4381bcba70153a0ee0385ef440c7a6e2d7745536?ds=sidebyside;hp=db22e7bfc719e0e5a3caa8e736b2518e218f0afe Makefile: detect Python 3 --- diff --git a/Makefile b/Makefile index 89a3105..ecdb230 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,21 @@ JEKYLL=jekyll JEKYLL_VERSION=3.8.5 PARSER=bin/markdown_ast.rb DST=_site -PYTHON=python3 + +# Check Python 3 (https://stackoverflow.com/a/4933395) +ifneq (, $(shell which python3)) + PYTHON := python3 +else ifneq (, $(shell which python)) + PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1))) + PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL}) + ifneq (3, ${PYTHON_VERSION_MAJOR}) + $(error "Your system does not appear to have Python 3 installed.") + endif + PYTHON := python +else + $(error "Your system does not appear to have any Python installed.") +endif + # Controls .PHONY : commands clean files