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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
#!/usr/bin/make
PACKAGE=schooltool.cando
LOCALES=src/schooltool/cando/locales
TRANSLATIONS_ZCML=schooltool/cando/translations.zcml
DIST=/home/ftp/pub/schooltool/flourish
PYTHON=python
INSTANCE_TYPE=schooltool
BUILDOUT_FLAGS=
.PHONY: all
all: build
.PHONY: build
build: .installed.cfg
python:
rm -rf python
virtualenv --no-site-packages -p $(PYTHON) python
.PHONY: bootstrap
bootstrap bin/buildout: python
python/bin/python bootstrap.py
.PHONY: buildout
buildout .installed.cfg: python bin/buildout buildout.cfg base.cfg setup.py
bin/buildout $(BUILDOUT_FLAGS)
.PHONY: update
update:
bzr up
$(MAKE) buildout BUILDOUT_FLAGS=-n
instance: | build
bin/make-schooltool-instance instance instance_type=$(INSTANCE_TYPE)
.PHONY: run
run: build instance
bin/start-schooltool-instance instance
.PHONY: tags
tags: build
bin/tags
.PHONY: clean
clean:
rm -rf python
rm -rf bin develop-eggs parts .installed.cfg
rm -rf build
rm -f ID TAGS tags
rm -rf coverage ftest-coverage
find . -name '*.py[co]' -delete
find . -name '*.mo' -delete
find . -name 'LC_MESSAGES' -exec rmdir -p --ignore-fail-on-non-empty {} +
.PHONY: realclean
realclean:
rm -rf eggs
rm -rf dist
rm -rf instance
$(MAKE) clean
# Tests
.PHONY: test
test: build
bin/test -u
.PHONY: ftest
ftest: build
bin/test -f
.PHONY: testall
testall: build
bin/test --at-level 2
# Coverage
.PHONY: coverage
coverage: build
rm -rf coverage
bin/test --at-level 2 -u --coverage=$(CURDIR)/coverage
.PHONY: coverage-reports-html
coverage-reports-html coverage/reports: build
test -d coverage || $(MAKE) coverage
rm -rf coverage/reports
mkdir coverage/reports
bin/coverage coverage coverage/reports
ln -s $(PACKAGE).html coverage/reports/index.html
.PHONY: ftest-coverage
ftest-coverage: build
rm -rf ftest-coverage
bin/test --at-level 2 -f --coverage=$(CURDIR)/ftest-coverage
.PHONY: ftest-coverage-reports-html
ftest-coverage-reports-html ftest-coverage/reports: build
test -d ftest-coverage || $(MAKE) ftest-coverage
rm -rf ftest-coverage/reports
mkdir ftest-coverage/reports
bin/coverage ftest-coverage ftest-coverage/reports
ln -s $(PACKAGE).html ftest-coverage/reports/index.html
# Translations
.PHONY: extract-translations
extract-translations: build
bin/i18nextract --egg $(PACKAGE) \
--domain $(PACKAGE) \
--zcml $(TRANSLATIONS_ZCML) \
--output-file $(LOCALES)/$(PACKAGE).pot
.PHONY: compile-translations
compile-translations:
for f in $(LOCALES)/*.po; do \
mkdir -p $${f%.po}/LC_MESSAGES; \
msgfmt -o $${f%.po}/LC_MESSAGES/$(PACKAGE).mo $$f;\
done
.PHONY: update-translations
update-translations:
for f in $(LOCALES)/*.po; do \
msgmerge -qUN $$f $(LOCALES)/$(PACKAGE).pot ;\
done
$(MAKE) compile-translations
# Release
.PHONY: release
release: compile-translations
grep -qv 'dev' version.txt.in || echo -n `cat version.txt.in`-r`bzr revno` > version.txt
$(PYTHON) setup.py sdist
rm -f version.txt
.PHONY: move-release
move-release: upload
rm -v dist/$(PACKAGE)-*dev-r*.tar.gz
.PHONY: upload
upload:
@VERSION=`cat version.txt.in` ;\
DIST=$(DIST) ;\
grep -qv 'dev' version.txt.in || VERSION=`cat version.txt.in`-r`bzr revno` ;\
grep -qv 'dev' version.txt.in || DIST=$(DIST)/dev ;\
if [ -w $${DIST} ] ; then \
echo cp dist/$(PACKAGE)-$${VERSION}.tar.gz $${DIST} ;\
cp dist/$(PACKAGE)-$${VERSION}.tar.gz $${DIST} ;\
else \
echo scp dist/$(PACKAGE)-$${VERSION}.tar.gz* schooltool.org:$${DIST} ;\
scp dist/$(PACKAGE)-$${VERSION}.tar.gz* schooltool.org:$${DIST} ;\
fi
# Helpers
.PHONY: ubuntu-environment
ubuntu-environment:
sudo apt-get install bzr build-essential gettext enscript ttf-liberation \
python-all-dev python-virtualenv \
libicu-dev libxslt1-dev libfreetype6-dev libjpeg62-dev
|