-
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 7 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 |
---|---|---|
|
@@ -10,6 +10,7 @@ Most use cases for micropayments involve a single user or device interacting | |
repeatedly with a few vendors. | ||
|
||
## Prerequisites | ||
`iota-swarm-node`, compatible with Python3+ as well as depending on [Pyota](https://github.com/iotaledger/iota.lib.py) is theoretically available for both Python 3.5 and 3.6; yet, our testing result indicates that the environment for Python 3.6 is invalid in this case. Details as [Pyota issue#203](https://github.com/iotaledger/iota.lib.py/issues/203). | ||
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. Correct the wording: "invalid" 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 "theoretically". Instead, it would be "expectedly" or something alike. 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. Replace 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 "as well". 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. Rewrite the abobe wording to
|
||
|
||
Install dependent packages: | ||
```shell | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# check Python version | ||
PYTHON := $(shell which "python") | ||
PYTHON_COMPATIBLE_VERSION = 3.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 "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. Ditto. |
||
install python$(PYTHON_COMPATIBLE_VERSION) 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". |
||
|
||
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)) | ||
|
||
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. |
||
PYTHON_COMPATIBLE_PATH := $(shell which "python"$(PYTHON_COMPATIBLE_VERSION)) | ||
|
||
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.") | ||
else | ||
$(error "$(shell python -V):Unsupported python version, only available for Python$(PYTHON_COMPATIBLE_VERSION).") | ||
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. Replace |
||
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") | ||
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.
It is
PyOTA
instead ofPyota
.