Improve python path and version checking.
epsi-builds/msspec_python3/pipeline/head This commit looks good
Details
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:
parent
1db975233a
commit
72ba908be1
11
Makefile
11
Makefile
|
@ -1,19 +1,18 @@
|
||||||
include src/options.mk
|
include src/options.mk
|
||||||
|
|
||||||
PYTHON = python
|
PYTHON = python
|
||||||
|
PYMAJ = 3
|
||||||
|
PYMIN = 6
|
||||||
|
|
||||||
# Checking Python version
|
# Checking Python path and version
|
||||||
PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null)
|
PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null)
|
||||||
|
|
||||||
ifndef PYTHON_EXE
|
ifndef PYTHON_EXE
|
||||||
$(error Unable to find the $(PYTHON) executable!)
|
$(error Unable to find the $(PYTHON) executable!)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PYTHON_VERSION_MAJOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f1)
|
ifeq ($(shell python -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0)
|
||||||
PYTHON_VERSION_MINOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f2)
|
$(error Python version >= $(PYMAJ).$(PYMIN) is needed!)
|
||||||
|
|
||||||
ifneq ($(shell test $(PYTHON_VERSION_MAJOR) -ge 3 -a $(PYTHON_VERSION_MINOR) -ge 6; echo $$?),0)
|
|
||||||
$(error Python version >= 3.6 is needed!)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue