Skip to content
This repository has been archived by the owner on Mar 18, 2019. It is now read-only.

Commit

Permalink
Perform sanity checks on Python3
Browse files Browse the repository at this point in the history
  • Loading branch information
yillkid committed Aug 18, 2018
1 parent d6ec40b commit f837ad5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include mk/python.mk
DCURL_DIR := deps/dcurl
DCURL_LIB := $(DCURL_DIR)/build/libdcurl.so
DEPS += $(DCURL_LIB)
Expand All @@ -19,7 +20,7 @@ TESTS += $(wildcard tests/tangleid/*.sh)
check: server.py $(DCURL_LIB)
@ TMP_PID=`mktemp /tmp/server_pid.XXXXXX`; \
echo "Running test suite..." ; \
( python $^ & echo $$! > $${TMP_PID} ); \
( $(PYTHON) $^ & echo $$! > $${TMP_PID} ); \
sleep 3 ; \
for i in $(TESTS); do \
( echo "\n\n==[ $$i ]==\n"; $$i || kill -9 `cat $${TMP_PID}` ) \
Expand Down
12 changes: 12 additions & 0 deletions mk/python.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PYTHON = python3
PYTHON := $(shell which $(PYTHON))
ifndef PYTHON
$(error "python3 is required.")
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 "skip $@ because PyOTA is not installed.")
endif

0 comments on commit f837ad5

Please sign in to comment.