forked from python-zk/kazoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (55 loc) · 1.81 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
HERE = $(shell pwd)
BIN = $(HERE)/bin
PYTHON = $(BIN)/python
PIP_DOWNLOAD_CACHE ?= $(HERE)/.pip_cache
INSTALL = $(BIN)/pip install
INSTALL += --download-cache $(PIP_DOWNLOAD_CACHE) --use-mirrors
BUILD_DIRS = bin build include lib lib64 man share
GEVENT_VERSION ?= 1.0b4
PYTHON_EXE = $(shell [ -f $(PYTHON) ] && echo $(PYTHON) || echo python)
PYPY = $(shell $(PYTHON_EXE) -c "import sys; print(getattr(sys, 'pypy_version_info', False) and 'yes' or 'no')")
TRAVIS_PYTHON_VERSION ?= $(shell $(PYTHON_EXE) -c "import sys; print('.'.join([str(s) for s in sys.version_info][:2]))")
ZOOKEEPER = $(BIN)/zookeeper
ZOOKEEPER_VERSION ?= 3.3.6
ZOOKEEPER_PATH ?= $(ZOOKEEPER)
GEVENT_SUPPORTED = yes
ifeq ($(findstring 3.,$(TRAVIS_PYTHON_VERSION)), 3.)
GEVENT_SUPPORTED = no
endif
ifeq ($(PYPY),yes)
GEVENT_SUPPORTED = no
endif
.PHONY: all build clean test zookeeper clean-zookeeper
all: build
$(PYTHON):
python sw/virtualenv.py --distribute .
rm distribute-0.6.*.tar.gz
build: $(PYTHON)
ifeq ($(GEVENT_SUPPORTED),no)
$(INSTALL) -U -r requirements3.txt
else
$(INSTALL) -U -r requirements.txt
$(INSTALL) -f https://code.google.com/p/gevent/downloads/list?can=1 gevent==$(GEVENT_VERSION)
endif
$(PYTHON) setup.py develop
$(INSTALL) kazoo[test]
clean:
rm -rf $(BUILD_DIRS)
test:
ZOOKEEPER_PATH=$(ZOOKEEPER_PATH) \
$(BIN)/nosetests -d --with-coverage kazoo.tests -v
html:
cd docs && \
make html
$(ZOOKEEPER):
@echo "Installing Zookeeper"
mkdir -p bin
cd bin && \
curl --progress-bar http://apache.osuosl.org/zookeeper/zookeeper-$(ZOOKEEPER_VERSION)/zookeeper-$(ZOOKEEPER_VERSION).tar.gz | tar -zx
mv bin/zookeeper-$(ZOOKEEPER_VERSION) bin/zookeeper
cd bin/zookeeper && ant compile
chmod a+x bin/zookeeper/bin/zkServer.sh
@echo "Finished installing Zookeeper"
zookeeper: $(ZOOKEEPER)
clean-zookeeper:
rm -rf zookeeper bin/zookeeper