~sielibre/schooltool.isli/2.10_packaging

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Douglas Cerna
  • Date: 2015-06-12 04:42:26 UTC
  • Revision ID: douglascerna@yahoo.com-20150612044226-be4m4qp840cjjs75
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/make
 
2
 
 
3
PACKAGE=schooltool.isli
 
4
LOCALES=src/schooltool/isli/locales
 
5
TRANSLATIONS_ZCML=schooltool/isli/translations.zcml
 
6
 
 
7
DIST=/home/ftp/pub/schooltool/ark
 
8
PYTHON=python
 
9
 
 
10
INSTANCE_TYPE=schooltool
 
11
BUILDOUT_FLAGS=
 
12
 
 
13
.PHONY: all
 
14
all: build
 
15
 
 
16
.PHONY: build
 
17
build: .installed.cfg
 
18
 
 
19
python:
 
20
        rm -rf python
 
21
        virtualenv --no-site-packages -p $(PYTHON) python
 
22
 
 
23
.PHONY: bootstrap
 
24
bootstrap bin/buildout: | buildout.cfg python
 
25
        python/bin/python bootstrap.py
 
26
 
 
27
buildout.cfg:
 
28
        cp deploy.cfg buildout.cfg
 
29
 
 
30
.PHONY: buildout
 
31
buildout .installed.cfg: python bin/buildout buildout.cfg base.cfg deploy.cfg setup.py
 
32
        bin/buildout $(BUILDOUT_FLAGS)
 
33
 
 
34
.PHONY: develop
 
35
develop bin/coverage: buildout.cfg develop.cfg
 
36
        sed -e 's/base.cfg/develop.cfg/' -i buildout.cfg
 
37
        $(MAKE) buildout
 
38
 
 
39
.PHONY: update
 
40
update:
 
41
        bzr up
 
42
        $(MAKE) buildout BUILDOUT_FLAGS=-n
 
43
 
 
44
instance: | build
 
45
        bin/make-schooltool-instance instance instance_type=$(INSTANCE_TYPE)
 
46
 
 
47
.PHONY: run
 
48
run: build instance
 
49
        bin/start-schooltool-instance instance
 
50
 
 
51
.PHONY: tags
 
52
tags: build
 
53
        bin/ctags
 
54
 
 
55
.PHONY: clean
 
56
clean:
 
57
        rm -rf python
 
58
        rm -rf bin develop-eggs parts .installed.cfg
 
59
        rm -rf build
 
60
        rm -f ID TAGS tags
 
61
        rm -rf coverage ftest-coverage
 
62
        find . -name '*.py[co]' -delete
 
63
        find . -name '*.mo' -delete
 
64
        find . -name 'LC_MESSAGES' -exec rmdir -p --ignore-fail-on-non-empty {} +
 
65
 
 
66
.PHONY: realclean
 
67
realclean:
 
68
        rm -f buildout.cfg
 
69
        rm -rf eggs
 
70
        rm -rf dist
 
71
        rm -rf instance
 
72
        $(MAKE) clean
 
73
 
 
74
# Tests
 
75
 
 
76
.PHONY: test
 
77
test: build
 
78
        bin/test -u
 
79
 
 
80
.PHONY: ftest
 
81
ftest: build
 
82
        bin/test -f
 
83
 
 
84
.PHONY: testall
 
85
testall: build
 
86
        bin/test --at-level 2
 
87
 
 
88
# Coverage
 
89
 
 
90
.PHONY: coverage
 
91
coverage: build
 
92
        rm -rf coverage
 
93
        bin/test --at-level 2 -u --coverage=$(CURDIR)/coverage
 
94
 
 
95
.PHONY: coverage-reports-html
 
96
coverage-reports-html coverage/reports: bin/coverage build
 
97
        test -d coverage || $(MAKE) coverage
 
98
        rm -rf coverage/reports
 
99
        mkdir coverage/reports
 
100
        bin/coverage coverage coverage/reports
 
101
        ln -s $(PACKAGE).html coverage/reports/index.html
 
102
 
 
103
.PHONY: ftest-coverage
 
104
ftest-coverage: build
 
105
        rm -rf ftest-coverage
 
106
        bin/test --at-level 2 -f --coverage=$(CURDIR)/ftest-coverage
 
107
 
 
108
.PHONY: ftest-coverage-reports-html
 
109
ftest-coverage-reports-html ftest-coverage/reports: bin/coverage build
 
110
        test -d ftest-coverage || $(MAKE) ftest-coverage
 
111
        rm -rf ftest-coverage/reports
 
112
        mkdir ftest-coverage/reports
 
113
        bin/coverage ftest-coverage ftest-coverage/reports
 
114
        ln -s $(PACKAGE).html ftest-coverage/reports/index.html
 
115
 
 
116
# Translations
 
117
 
 
118
.PHONY: extract-translations
 
119
extract-translations: build
 
120
        bin/i18nextract --egg $(PACKAGE) \
 
121
                        --domain $(PACKAGE) \
 
122
                        --zcml $(TRANSLATIONS_ZCML) \
 
123
                        --output-file $(LOCALES)/$(PACKAGE).pot
 
124
 
 
125
.PHONY: compile-translations
 
126
compile-translations:
 
127
        for f in $(LOCALES)/*.po; do \
 
128
            mkdir -p $${f%.po}/LC_MESSAGES; \
 
129
            msgfmt -o $${f%.po}/LC_MESSAGES/$(PACKAGE).mo $$f;\
 
130
        done
 
131
 
 
132
.PHONY: update-translations
 
133
update-translations:
 
134
        for f in $(LOCALES)/*.po; do \
 
135
            msgmerge -qUN $$f $(LOCALES)/$(PACKAGE).pot ;\
 
136
        done
 
137
        $(MAKE) compile-translations
 
138
 
 
139
# Release
 
140
 
 
141
.PHONY: release
 
142
release: compile-translations
 
143
        -cp buildout.cfg buildout.cfg~dev~
 
144
        cp deploy.cfg buildout.cfg
 
145
        grep -qv 'dev' version.txt.in || echo -n `cat version.txt.in`-r`bzr revno` > version.txt
 
146
        $(PYTHON) setup.py sdist
 
147
        rm -f version.txt
 
148
        -mv buildout.cfg~dev~ buildout.cfg
 
149
 
 
150
.PHONY: move-release
 
151
move-release: upload
 
152
        rm -v dist/$(PACKAGE)-*dev-r*.tar.gz
 
153
 
 
154
.PHONY: upload
 
155
upload:
 
156
        set -e ;\
 
157
        VERSION=`cat version.txt.in` ;\
 
158
        DIST=$(DIST) ;\
 
159
        grep -qv 'dev' version.txt.in || VERSION=`cat version.txt.in`-r`bzr revno` ;\
 
160
        grep -qv 'dev' version.txt.in || DIST=$(DIST)/dev ;\
 
161
        if [ -w $${DIST} ] ; then \
 
162
            echo cp dist/$(PACKAGE)-$${VERSION}.tar.gz $${DIST} ;\
 
163
            cp dist/$(PACKAGE)-$${VERSION}.tar.gz $${DIST} ;\
 
164
        else \
 
165
            echo scp dist/$(PACKAGE)-$${VERSION}.tar.gz* ftp.schooltool.org:$${DIST} ;\
 
166
            scp dist/$(PACKAGE)-$${VERSION}.tar.gz* ftp.schooltool.org:$${DIST} ;\
 
167
        fi
 
168
 
 
169
# Helpers
 
170
 
 
171
.PHONY: ubuntu-environment
 
172
ubuntu-environment:
 
173
        sudo apt-get install build-essential gettext enscript \
 
174
            python-dev python-virtualenv \
 
175
            ttf-ubuntu-font-family ttf-liberation \
 
176
            libicu-dev libxslt1-dev libfreetype6-dev libjpeg-dev