-
Notifications
You must be signed in to change notification settings - Fork 9
Perform sanity checks with Python3 #25
base: master
Are you sure you want to change the base?
Changes from 1 commit
d6ec40b
f837ad5
5e75e2e
6692705
365e066
cb5ad42
0b1bbf8
91f89af
81ffc18
98eccb6
e74d2ee
81a82b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,35 @@ | ||
PYTHON = python3.5 | ||
PYTHON := $(shell which $(PYTHON)) | ||
# check Python version | ||
PYTHON := $(shell which "python") | ||
PYTHON_COMPATIBLE = python3.5 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No blank line here. |
||
ifndef PYTHON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add extra condition if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
$(error "python3.5 is required.") | ||
$(error "Python is not executable, try to check the PATH environment variable or install $(PYTHON_COMPATIBLE) package.") | ||
endif # PYTHON | ||
|
||
ifdef PYTHON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't have to check |
||
PY_CHECK_VERSION := $(shell python -c "print(__import__('sys').version_info[0:2])") | ||
|
||
ifneq ($(PY_CHECK_VERSION), (3, 5)) | ||
PYTHON_COMPATIBLE_PATH := $(shell which $(PYTHON_COMPATIBLE)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't rely on new var |
||
|
||
ifdef PYTHON_COMPATIBLE_PATH | ||
$(error "Found $(PYTHON_COMPATIBLE) in current environment, but it should be setting as \ | ||
default interpreter, try to create a symbolic link for $(PYTHON_COMPATIBLE_PATH)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't suggest to make symbolic link. Instead, configure via environment variables. |
||
else | ||
$(error "$(shell python -V):Invalid Python version, only available for $(PYTHON_COMPATIBLE).") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is NOT |
||
endif | ||
endif | ||
endif # PYTHON | ||
|
||
ifndef PYTHON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. Focus on detailed items. |
||
|
||
endif # PYTHON | ||
|
||
# check "iota" module in Python installation | ||
ifdef PYTHON | ||
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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Python executable is restricted, the validation of |
||
endif | ||
endif # PYTHON | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid nested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename it to
PYTHON35
to reflect its functionality.