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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
#!/usr/bin/make
PACKAGE=schooltool
LOCALES=src/schooltool/locales
TRANSLATIONS_ZCML=schooltool/common/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)
instance/var/supervisord.pid:
bin/supervisord
.PHONY: run
run: build instance instance/var/supervisord.pid
@bin/supervisorctl start "services:*"
@bin/supervisorctl status schooltool | grep RUNNING && bin/supervisorctl stop schooltool || exit 0
@bin/supervisorctl status
bin/start-schooltool-instance instance
.PHONY: start
start: build instance instance/var/supervisord.pid
bin/supervisorctl start all
@bin/supervisorctl status
.PHONY: start-services
start-services: build instance instance/var/supervisord.pid
@bin/supervisorctl status | grep services[:] | grep -v RUNNING && bin/supervisorctl start "services:*" || exit 0
@bin/supervisorctl status | grep services[:]
.PHONY: restart
restart: build instance instance/var/supervisord.pid
bin/supervisorctl restart "services:celery"
@bin/supervisorctl start "services:*"
bin/supervisorctl restart schooltool
@bin/supervisorctl status
.PHONY: stop
stop:
@test -S instance/var/supervisord.sock && bin/supervisorctl status | grep -v STOPPED && bin/supervisorctl stop all || exit 0
@test -S instance/var/supervisord.sock && bin/supervisorctl shutdown || echo Nothing to stop
@rm -f instance/var/zeo.sock
@rm -f instance/var/supervisord.sock
@rm -f instance/var/supervisord.pid
.PHONY: status
status:
@test -f instance/var/supervisord.pid && bin/supervisorctl status || echo All services shut down
.PHONY: tags
tags: build
bin/tags
.PHONY: clean
clean: stop
rm -rf python
rm -rf bin develop-eggs parts .installed.cfg
rm -rf build
rm -f ID TAGS tags
rm -rf coverage ftest-coverage
rm -rf docs
rm -rf instance/var/celerybeat-schedule
rm -rf instance/var/redis-dump.rdb
rm -rf instance/var/zeo.sock
rm -rf instance/var/supervisord.sock
rm -rf instance/var/supervisord.pid
rm -rf instance/var/Data.fs.lock
find . -name '*.py[co]' -delete
find . -name '*.mo' -delete
find . -name 'LC_MESSAGES' -exec rmdir -p --ignore-fail-on-non-empty {} +
.PHONY: realclean
realclean: stop
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
# Docs
docs: build
bin/docs
# 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 ttf-ubuntu-font-family \
libicu-dev libxslt1-dev libfreetype6-dev libjpeg62-dev \
redis-server
|