-
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 all commits
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# check Python version | ||
PY_FAVORED_VER = 3.5 | ||
PYTHON := $(shell which "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. 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 |
||
PYTHON := $(shell which "python3") | ||
endif | ||
|
||
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 | ||
PYTHON := $(shell which "python$(PY_FAVORED_VER)") | ||
endif | ||
|
||
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. |
||
$(error "Python is not executable, try to check the PATH environment variable or \ | ||
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 ambiguous to say "Python is not executable". Use precise words. |
||
install python$(PY_FAVORED_VER) package.") | ||
endif # $(shell which "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. Remove non-effective "$(shell which "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. Let's say, "no valid Python interpreter is found". |
||
|
||
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 this blank line. |
||
PY_CHECK_VERSION := $(shell $(PYTHON) -V) | ||
|
||
ifeq "$(filter $(PY_FAVORED_VER).%, $(PY_CHECK_VERSION))" "" | ||
PYTHON := $(shell which "python"$(PY_FAVORED_VER)) | ||
ifdef PYTHON | ||
$(error "Found python$(PY_FAVORED_VER), but it should be set as \ | ||
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. Do you think it is valid according to the error message? |
||
default interpreter, try to set $(PYTHON) in PATH environment variable.") | ||
else | ||
$(error "$(shell python -V):Unsupported python version, only available for Python$(PY_FAVORED_VER).") | ||
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. Explain the exact reason and point unresolved issue(s) here. 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. Validate ifdef-else statement. Logic error. |
||
endif # PYTHON | ||
endif # "$(filter ... | ||
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. You don't have to mention "$(filter ..." once you remove nested conditions. |
||
|
||
# check "iota" module in Python installation | ||
PY_CHECK_MOD_IOTA := $(shell python -c "import iota" 2>/dev/null && \ | ||
echo 1 || echo 0) | ||
ifeq ("$(PY_CHECK_MOD_IOTA)","0") | ||
PIP := $(shell pip -V && echo 1 || echo 0)) | ||
PIP_CHECK_VERSION := $(findstring python 3, $(PIP) && echo $@ || echo 0) | ||
endif | ||
|
||
ifneq ("$(PIP)", "1") | ||
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. Use |
||
$(error "PIP package doesn't pre-configured, try to install it.") | ||
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. Fix grammar error. |
||
endif | ||
|
||
ifeq ("$(PIP_CHECK_VERSION)", "0") | ||
PIP_FAVORED_VER = 3 | ||
endif | ||
|
||
ifeq ("$(PY_CHECK_MOD_IOTA)", "0") | ||
$(error "PyOTA package doesn't pre-configured, install the latest version: pip$(PIP_FAVORED_VER) 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. Ditto. Fix grammar. 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. Using |
||
endif |
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.
PyOTA doesn't support Python 3.7 because it has package
Filters
which doesn't either.