This repository was archived by the owner on Mar 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
# check Python version | ||
PY_FAVORED_VER = 3.5 | ||
PYTHON := $(shell which "python") | ||
PYTHON_COMPATIBLE_VERSION = 3.5 | ||
ifndef PYTHON | ||
PYTHON := $(shell which "python3") | ||
endif | ||
|
||
ifndef PYTHON | ||
PYTHON := $(shell which "python$(PY_FAVORED_VER)") | ||
endif | ||
|
||
ifndef PYTHON | ||
$(error "Python is not executable, try to check the PATH environment variable or \ | ||
install python$(PYTHON_COMPATIBLE_VERSION) package.") | ||
install python$(PY_FAVORED_VER) package.") | ||
endif # $(shell which "python") | ||
|
||
PY_CHECK_VERSION := $(shell python -c "print(str(__import__('sys').version_info.major) + \ | ||
str('.') + str(__import__('sys').version_info.minor) )") | ||
|
||
ifneq ($(PY_CHECK_VERSION), $(PYTHON_COMPATIBLE_VERSION)) | ||
|
||
PYTHON_COMPATIBLE_PATH := $(shell which "python"$(PYTHON_COMPATIBLE_VERSION)) | ||
PY_CHECK_VERSION := $(shell $(PYTHON) -V) | ||
|
||
ifdef PYTHON_COMPATIBLE_PATH | ||
$(error "Found python$(PYTHON_COMPATIBLE_VERSION) in current environment, but it should be setting as \ | ||
default interpreter, try to set $(PYTHON_COMPATIBLE_PATH) in PATH environment variable.") | ||
ifeq "$(filter $(PY_FAVORED_VER).%, $(PY_CHECK_VERSION))" "" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jserv
Collaborator
|
||
PYTHON := $(shell which "python"$(PY_FAVORED_VER)) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
ifdef PYTHON | ||
$(error "Found python$(PY_FAVORED_VER), but it should be set as \ | ||
default interpreter, try to set $(PYTHON) in PATH environment variable.") | ||
else | ||
$(error "$(shell python -V):Unsupported python version, only available for Python$(PYTHON_COMPATIBLE_VERSION).") | ||
$(error "$(shell python -V):Unsupported python version, only available for Python$(PY_FAVORED_VER).") | ||
endif | ||
endif | ||
|
||
# check "iota" module in Python installation | ||
PY_CHECK_MOD_IOTA := $(shell python -c "import iota" 2>/dev/null && \ | ||
echo 1 || echo 0) | ||
ifneq ("$(PY_CHECK_MOD_IOTA)","1") | ||
$(error "Dependency error $@ because PyOTA is not installed, to install the latest version: pip3 install pyota") | ||
$(error "Dependency error $@ because PyOTA is not installed, to install the latest version: pip install pyota") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jserv
Collaborator
|
||
endif |
It looks ugly. Can you improve the condition?