Improve python path and version checking.
epsi-builds/msspec_python3/pipeline/head This commit looks good Details

In the top Makefile, the Python path and version are first checked
before going any further. This is now done in a more cleaner way
by looking at the "sys.version_info variable"
This commit is contained in:
sylvain tricot 2021-01-21 11:12:24 +01:00
parent 1db975233a
commit 72ba908be1
1 changed files with 5 additions and 6 deletions

View File

@ -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