~canonical-ca-hackers/isitdeployable/trunk

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
# Copyright (C) 2012  Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

EXTERNAL_PY?=python2.7
PY=./bin/py

EXTERNAL_BUILDOUT?=$(EXTERNAL_PY) bootstrap.py
BUILDOUT=./bin/buildout

CA_EGGS_DIR?=../eggs
CA_DOWNLOAD_CACHE_DIR?=../download-cache

clean:
	$(RM) -r bin/buildout
	$(RM) -r bin/py
	$(RM) -r bin/discover
	$(RM) -r develop-eggs
	$(RM) -r parts
	$(RM) -r .installed.cfg
ifeq ($(CA_EGGS_DIR),eggs)
	$(RM) -r eggs
else
	$(RM) eggs
endif
ifeq ($(CA_DOWNLOAD_CACHE_DIR),download-cache)
	$(RM) -r download-cache
else
	$(RM) download-cache
endif

download-cache:
ifeq ($(CA_DOWNLOAD_CACHE_DIR),$@)
	bzr checkout lp:ca-download-cache $@
else
	[ -d $(CA_DOWNLOAD_CACHE_DIR) ] || bzr checkout lp:ca-download-cache $(CA_DOWNLOAD_CACHE_DIR)
	ln -s $(CA_DOWNLOAD_CACHE_DIR) $@
endif

eggs:
ifeq ($(CA_EGGS_DIR),$@)
	mkdir $@
else
	[ -d $(CA_EGGS_DIR) ] || mkdir $(CA_EGGS_DIR)
	ln -s $(CA_EGGS_DIR) $@
endif

$(BUILDOUT): bootstrap.py buildout.cfg setup.py versions.cfg eggs download-cache
	$(EXTERNAL_BUILDOUT) --distribute --version 1.5.1 \
				--download-base=download-cache/dist --eggs=eggs \
				--setup-source distribute_setup.py
	touch --no-create $@

$(PY): $(BUILDOUT)
	$(BUILDOUT)
	touch --no-create $@

bootstrap: clean $(PY)

test: $(PY)
	$(TEST_COMMAND)

check: test

# Can be used to update the dependencies when you change something
# in versions.cfg.
update-deps: $(BUILDOUT)
	$(BUILDOUT) buildout:install-from-cache=false buildout:allow-picked-versions=true

.PHONY: bootstrap check clean test update-deps
.DEFAULT_GOAL := $(PY)