/
Makefile
72 lines (55 loc) · 2.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
TMP = tmp
TEST_VENV = venv
PY2_VENV = $(TEST_VENV)/py2
PY3_VENV = $(TEST_VENV)/py3
TESTS_PY = koheron/test/tests.py koheron/test/exception_tests.py koheron/test/context_tests.py koheron/test/cli_tests.py
PYPI_VERSION=$(shell curl -s 'https://pypi.python.org/pypi/koheron/json'| PYTHONIOENCODING=utf8 python -c "import sys, json; print json.load(sys.stdin)['info']['version']")
CURRENT_VERSION=$(shell python -c "from koheron.version import __version__; print(__version__)")
.PHONY: test test_common deploy clean_dist clean_venv clean
# -------------------------------------------------------------------------------------
# Provides start_koheron_server and stop_koheron_server targets
# -------------------------------------------------------------------------------------
KOHERON_SERVER_DEST=$(TMP)
KOHERON_SERVER_BRANCH = v0.13.0
KOHERON_SERVER_MK=build_run.mk
DUMMY:=$(shell curl https://raw.githubusercontent.com/Koheron/koheron-server/$(KOHERON_SERVER_BRANCH)/scripts/build_run.mk > $(KOHERON_SERVER_MK))
include $(KOHERON_SERVER_MK)
# -------------------------------------------------------------------------------------
# Tests
# -------------------------------------------------------------------------------------
$(PY2_VENV): requirements.txt
test -d $(PY2_VENV) || (virtualenv $(PY2_VENV) && \
$(PY2_VENV)/bin/pip install -r requirements.txt && \
$(PY2_VENV)/bin/pip install numpy==1.11.1 pytest)
$(PY3_VENV): requirements.txt
test -d $(PY3_VENV) || (virtualenv -p python3 $(PY3_VENV) && \
$(PY3_VENV)/bin/pip3 install -r requirements.txt && \
$(PY3_VENV)/bin/pip3 install numpy==1.11.1 pytest)
test: $(PY2_VENV) $(PY3_VENV) $(TESTS_PY)
PYTEST_UNIXSOCK=/tmp/kserver_local.sock $(PY2_VENV)/bin/python -m pytest -v $(TESTS_PY)
PYTEST_UNIXSOCK=/tmp/kserver_local.sock $(PY3_VENV)/bin/python3 -m pytest -v $(TESTS_PY)
test_common:
$(PY2_VENV)/bin/python -m pytest -v koheron/test/test_common.py
$(PY3_VENV)/bin/python3 -m pytest -v koheron/test/test_common.py
# -------------------------------------------------------------------------------------
# Deploy
# -------------------------------------------------------------------------------------
deploy: clean_dist $(PY2_VENV)
@echo PYPI_VERSION = $(PYPI_VERSION)
# @echo CURRENT_VERSION = $(CURRENT_VERSION)
ifneq ($(PYPI_VERSION),$(shell $(PY2_VENV)/bin/python -c "from koheron.version import __version__; print(__version__)"))
python setup.py sdist bdist_wheel
twine upload -u $(PYPI_USERNAME) -p $(PYPI_PASSWORD) dist/*
endif
# -------------------------------------------------------------------------------------
# Clean
# -------------------------------------------------------------------------------------
clean_dist:
rm -rf build
rm -rf dist
rm -rf koheron.egg-info
clean_venv:
rm -rf $(TEST_VENV)
clean: clean_dist
rm -rf $(TMP)
rm -f $(KOHERON_SERVER_MK)