diff --git a/Makefile b/Makefile index 0440e6b..7767837 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,18 @@ include src/options.mk PYTHON = python +PYMAJ = 3 +PYMIN = 6 -# Checking Python version +# Checking Python path and version PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null) ifndef PYTHON_EXE $(error Unable to find the $(PYTHON) executable!) endif -PYTHON_VERSION_MAJOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f1) -PYTHON_VERSION_MINOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f2) - -ifneq ($(shell test $(PYTHON_VERSION_MAJOR) -ge 3 -a $(PYTHON_VERSION_MINOR) -ge 6; echo $$?),0) - $(error Python version >= 3.6 is needed!) +ifeq ($(shell python -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0) + $(error Python version >= $(PYMAJ).$(PYMIN) is needed!) endif