forked from aio-libs-abandoned/aioredis-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (78 loc) · 2.2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
PYTHON ?= python3
FLAKE ?= flake8
PYTEST ?= py.test
REDIS_VERSION ?= "$(shell redis-cli INFO SERVER | sed -n 2p)"
REDIS_TAGS ?= 2.6.17 2.8.22 3.0.7 3.2.8 4.0.2 unstable
ARCHIVE_URL = https://github.com/antirez/redis/archive
INSTALL_DIR ?= build
TEST_ARGS ?= "-n 4"
REDIS_TARGETS = $(foreach T,$(REDIS_TAGS),$(INSTALL_DIR)/$T/redis-server)
# Python implementation
PYTHON_IMPL = $(shell $(PYTHON) -c "import sys; print(sys.implementation.name)")
EXAMPLES = $(shell find examples -name "*.py")
.PHONY: all flake doc man-doc spelling test cov dist devel clean
all: aioredis.egg-info flake doc cov
doc: spelling
make -C docs html
man-doc: spelling
make -C docs man
spelling:
@echo "Running spelling check"
make -C docs spelling
ifeq ($(PYTHON_IMPL), cpython)
flake:
$(FLAKE) aioredis tests examples
else
flake:
@echo "Job is not configured to run on $(PYTHON_IMPL); skipped."
endif
test:
$(PYTEST)
cov coverage:
$(PYTEST) --cov
dist: clean man-doc
$(PYTHON) setup.py sdist bdist_wheel
clean:
-rm -r docs/_build
-rm -r build dist aioredis.egg-info
devel: aioredis.egg-info
pip install -U pip
pip install -U \
sphinx \
sphinx_rtd_theme \
bumpversion \
wheel
pip install -Ur tests/requirements.txt
pip install -Ur docs/requirements.txt
aioredis.egg-info:
pip install -Ue .
ifdef TRAVIS
examples: .start-redis $(EXAMPLES)
else
examples: $(EXAMPLES)
endif
$(EXAMPLES):
@export REDIS_VERSION="$(redis-cli INFO SERVER | sed -n 2p)"
$(PYTHON) $@
.start-redis: $(lastword $(REDIS_TARGETS))
$< ./examples/redis.conf
$< ./examples/redis-sentinel.conf --sentinel
sleep 5s
echo "QUIT" | nc localhost 6379
echo "QUIT" | nc localhost 26379
.PHONY: $(EXAMPLES)
certificate:
make -C tests/ssl
ci-test: $(REDIS_TARGETS)
@$(call echo, "Tests run")
py.test -rsxX --cov \
$(foreach T,$(REDIS_TARGETS),--redis-server=$T) $(TEST_ARGS)
ci-test-%: $(INSTALL_DIR)/%/redis-server
py.test -rsxX --cov --redis-server=$< $(TEST_ARGS)
ci-build-redis: $(REDIS_TARGETS)
$(INSTALL_DIR)/%/redis-server:
@echo "Building redis-$*..."
wget -nv -c $(ARCHIVE_URL)/$*.tar.gz -O - | tar -xzC /tmp
make -j -C /tmp/redis-$* \
INSTALL_BIN=$(abspath $(INSTALL_DIR))/$* install >/dev/null 2>/dev/null
@echo "Done building redis-$*"