This repository has been archived by the owner on Aug 20, 2019. It is now read-only.
/
Makefile
108 lines (86 loc) · 2.8 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
106
107
108
APPNAME = queuey
DEPS =
HERE = $(shell pwd)
BIN = $(HERE)/bin
VIRTUALENV = virtualenv-2.6
NOSE = bin/nosetests -s --with-xunit
TESTS = $(APPNAME)/tests
PYTHON = $(HERE)/bin/python
BUILDAPP = $(HERE)/bin/buildapp
BUILDRPMS = $(HERE)/bin/buildrpms
PYPI = http://pypi.python.org/simple
PYPIOPTIONS = -i $(PYPI)
DOTCHANNEL := $(wildcard .channel)
ifeq ($(strip $(DOTCHANNEL)),)
CHANNEL = dev
RPM_CHANNEL = prod
else
CHANNEL = `cat .channel`
RPM_CHANNEL = `cat .channel`
endif
INSTALL = $(HERE)/bin/pip install
PIP_DOWNLOAD_CACHE ?= /tmp/pip_cache
INSTALLOPTIONS = --download-cache $(PIP_DOWNLOAD_CACHE) -U -i $(PYPI)
ifdef PYPIEXTRAS
PYPIOPTIONS += -e $(PYPIEXTRAS)
INSTALLOPTIONS += -f $(PYPIEXTRAS)
endif
ifdef PYPISTRICT
PYPIOPTIONS += -s
ifdef PYPIEXTRAS
HOST = `python -c "import urlparse; print urlparse.urlparse('$(PYPI)')[1] + ',' + urlparse.urlparse('$(PYPIEXTRAS)')[1]"`
else
HOST = `python -c "import urlparse; print urlparse.urlparse('$(PYPI)')[1]"`
endif
endif
INSTALL += $(INSTALLOPTIONS)
SW = sw
CASSANDRA = $(BIN)/cassandra/bin/cassandra
BUILD_DIRS = bin build deps include lib lib64
.PHONY: all build test build_rpms mach
.SILENT: lib python pip $(CASSANDRA) cassandra
all: build
$(BIN)/python:
python $(SW)/virtualenv.py --no-site-packages --distribute .
$(BIN)/pip: $(BIN)/python
lib: $(BIN)/pip
echo "Installing package pre-requisites..."
$(INSTALL) -r dev-reqs.txt
echo "Running setup.py develop"
$(PYTHON) setup.py develop
$(CASSANDRA):
echo "Installing Cassandra"
mkdir -p bin
cd bin && \
curl --silent http://downloads.datastax.com/community/dsc-cassandra-1.0.7-bin.tar.gz | tar -zvx
mv bin/dsc-cassandra-1.0.7 bin/cassandra
cp etc/cassandra/cassandra.yaml bin/cassandra/conf/cassandra.yaml
cp etc/cassandra/log4j-server.properties bin/cassandra/conf/log4j-server.properties
cd bin/cassandra/lib && \
curl -O http://java.net/projects/jna/sources/svn/content/trunk/jnalib/dist/jna.jar
echo "Finished installing Cassandra"
cassandra: $(CASSANDRA)
clean-env:
rm -rf $(BUILD_DIRS)
clean-cassandra:
rm -rf cassandra bin/cassandra
clean: clean-env
build: lib
$(BUILDAPP) -c $(CHANNEL) $(PYPIOPTIONS) $(DEPS)
test:
$(PYTHON) runtests.py
test-python:
TEST_STORAGE_BACKEND=queuey.storage.cassandra.CassandraQueueBackend \
TEST_METADATA_BACKEND=queuey.storage.cassandra.CassandraMetadata \
$(NOSE) --with-coverage --cover-package=queuey --cover-erase \
--cover-inclusive $(APPNAME)
build_rpms:
rm -rf rpms/
$(BUILDRPMS) -c $(RPM_CHANNEL) $(DEPS)
mach: build build_rpms
mach clean
mach yum install python26 python26-setuptools
cd rpms; wget http://mrepo.mozilla.org/mrepo/5-x86_64/RPMS.mozilla-services/gunicorn-0.11.2-1moz.x86_64.rpm
cd rpms; wget http://mrepo.mozilla.org/mrepo/5-x86_64/RPMS.mozilla/nginx-0.7.65-4.x86_64.rpm
mach yum install rpms/*
mach chroot python2.6 -m demoapp.run