forked from aio-libs-abandoned/aioredis-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (79 loc) · 2.29 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
105
PYTHON ?= python3
FLAKE ?= flake8
PYTEST ?= pytest
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.11 5.0.1
ARCHIVE_URL = https://github.com/antirez/redis/archive
INSTALL_DIR ?= build
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:
$(shell which redis-server) ./examples/redis.conf
$(shell which redis-server) ./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")
pytest --cov \
$(foreach T,$(REDIS_TARGETS),--redis-server=$T)
ci-test-%: $(INSTALL_DIR)/%/redis-server
pytest --cov --redis-server=$<
ci-build-redis: $(REDIS_TARGETS)
$(INSTALL_DIR)/%/redis-server: /tmp/redis-%/src/redis-server
mkdir -p $(abspath $(INSTALL_DIR))/$*
cp -p /tmp/redis-$*/src/redis-server $(abspath $(INSTALL_DIR))/$*/
@echo "Done building redis-$*"
/tmp/redis-%/src/redis-server:
@echo "Building redis-$*..."
wget -nv -c $(ARCHIVE_URL)/$*.tar.gz -O - | tar -xzC /tmp
$(MAKE) -j -C $(dir $@) redis-server >/dev/null 2>/dev/null