-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
277 lines (214 loc) · 7.79 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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
all:
@echo Targets:
@echo test - run tests
@echo pot - regenerate qbzr.pot translations template
@echo mo - build binary translations
@echo clean - remove build products
@echo tags - collect tags with ctags utility
@echo docs - build htmls for texts in docs/ directory
@echo epydoc - build API docs with epydoc
@echo ui - compile UI files
@echo inno - compile exe - pass RELEASE=X.Y.Z
@echo
@echo To build release run:
@echo make release
@echo the version will be picked up from version.txt
@echo MAKE SURE YOU COMMIT FIRST - brz export USES THE COMMITTED FILES
# We'll read the RELEASE number from version.txt
.PHONY: test pot mo clean tags docs ui
# Making pot files is disabled for now - no translators!
# pot:
# python3 setup.py build_pot -N -d.
RELEASE:=$(shell cat version.txt)
.check-env-vars:
$(info Building QBzr version ${RELEASE})
mo:
python3 setup.py build_mo -f --verbose
tarball: .check-env-vars
brz export --root=qbrz qbrz-$(RELEASE).tar.gz
rm -f qbrz-$(RELEASE).tar.gz.asc
# gpg2 -ab qbrz-$(RELEASE).tar.gz
# RJL needs to come back in
# inno: mo
# ./iscc installer/qbrz-setup.iss
# gpg -ab qbrz-setup-$(RELEASE).exe
inno: .check-env-vars
./iscc installer/qbrz-setup.iss /DVersion=$(RELEASE)
rm -f qbrz-setup-$(RELEASE).exe.asc
gpg2 -ab qbrz-setup-$(RELEASE).exe
# release: tarball inno
release: tarball inno
clean:
python3 ./setup.py clean -a
tags:
ctags *.py lib/*.py lib/extra/*.py lib/tests/*.py
epydoc:
epydoc.py -o api -v lib
docs:
$(MAKE) -C docs
ui:
python3 setup.py build_ui
# === Tests beyond this point ===
# When you run ``brz selftest``, Breezy will scan all its plugins to see if they contain a function named test_suite().
# For each plugin that does, it calls the function and adds any resulting tests to the master test suite.
# To run just the tests for plugin xxx, the command is: ``brz selftest -s bp.xxx`` so we use bp.qbrz in our case.
check:
BRZ_PLUGINS_AT=qbrz@$(shell pwd) brz selftest --starting-with=bp.qbrz --exclude=TestTreeFilterProxyModel --exclude=TestTreeWidget
# Stop on first error, ignore TestTreeFilterProxyModel for now
checkone:
BRZ_PLUGINS_AT=qbrz@$(shell pwd) brz selftest -v --one --starting-with=bp.qbrz --exclude=TestTreeFilterProxyModel
# Test specific item - e.g. for internationalisation, use:
#
# BRZ_PLUGINS_AT=qbrz@$(shell pwd) brz selftest --one --strict -s bp.qbrz TestI18n
checkspecific:
BRZ_PLUGINS_AT=qbrz@$(shell pwd) brz selftest -v --one --strict --starting-with=bp.qbrz test_show_widget
# Rather than running the test_ suite, this lets you run the actual plugin - note
# that the tests can often pass but the code fails in actual use.
qtest:
# You can test on qbrz itself like this (qlog in the below example):
#
# BRZ_PLUGINS_AT=qbrz@$(shell pwd) brz qlog
#
# If you have a test directory you wish to use, you can pass it to the relevant command.
# In this example, we have a test dir of ``~/pythonstuff/bzr_test_dir/dycco`` and we
# are developing in ~/pythonstuff/qbrz - thus we call brz with qadd and the dycco directory
# Note we have to use ${HOME} for BZR_PLUGINS_AT...
#
BRZ_PLUGINS_AT=qbrz@${HOME}/pythonstuff/qbrz brz qadd ~/pythonstuff/bzr_test_dir/dycco/
#BRZ_PLUGINS_AT=qbrz@${HOME}/pythonstuff/qbrz brz qannotate ~/pythonstuff/qbrz/lib/treewidget.py
#BRZ_PLUGINS_AT=qbrz@${HOME}/pythonstuff/qbrz brz qplugins
test:
brz selftest -s bp.qbrz
# Fully working: (note, qcheckout-ala-explorer is qgetn).
# qlog
# qadd <- fails to display new files
# qannotate, qblame
# qcommit
# qbrowse
# qcat, qviewer
# qversion
# qplugins
# qinit
# qbranch
# qbind
# qunbind
# qignore
# qinfo
# qupdate
# quncommit
# qpull
# qshelve
# qunshelve
# qtag
# qgetn
# qrevert
# qpush
# qsend
# qmerge
# qconflicts
# qresolve
# qswitch
# qcmd
# qsubprocess
# qdiff
# qconfig
# === qmain ===
# qmain fails in bzr
# === qverify-signatures ===
# qverify-signatures fails in bzr
# === qhelp ===
# qhelp doesn't work for me even in bzr
# === Items in Plug-ins ===
# NOT working
# qinit-workspace, qnew also unknown - they appear to be from the 'explorer' plugin
# === Literate documentation, etc ===
# This uses pycco to generate the literal documentation.
# To rebuild all of it, with an index.html file, use:
#
# make literate_index
#
# To just update (although new files won't be added to index.html), use:
#
# make literate_docs
#
# otherwise, you can just make the base, lib, or whatever using (for example):
#
# make widget_docs
#
# Output goes into docs/literate/... mirroring the source-code locations (e.g.
# lib/widgets/... go into docs/literate/lib/widgets
#
# pycco isn't brilliant, but it tries its best
# We build or rebuild the documentation with pycco - shorthand for the command here in PYCCO_ALL variable
# This one builds the index.html file
PYCCO_ALL := pycco --generate_index --paths -s --directory
# This one does NOT build the index file - otherwise, if you pass a single file
# it will be the ONLY one in the index. Do'h!
PYCCO_ONE := pycco --paths -s --directory
# We want to look at all the .py files in the Code directory (where we start)
# in case any have changed. The makefile is in /Code so we just use './'
# the shell for 'this directory that we are in' - so the following means
# 'all the files ending in "py" in this directory'
PYMAINSOURCES=$(wildcard ./*.py)
# The lib sources
PYLIBSOURCES=$(wildcard ./lib/*.py)
# extras and tests
PYEXTRASOURCES=$(wildcard ./lib/extra/*.py)
PYEXTRASSOURCES=$(wildcard ./extras/*.py)
PYTESTSSOURCES=$(wildcard ./lib/tests/*.py)
PYWIDGETSOURCES=$(wildcard ./lib/widgets/*.py)
# So now add them all together
PYSOURCES=$(PYMAINSOURCES) $(PYLIBSOURCES) $(PYEXTRASOURCES) $(PYEXTRASSOURCES) $(PYTESTSSOURCES) $(PYWIDGETSOURCES)
# This is how we extract an html file-name for each changed python file-name
# It basically reads: for each .py file in the source directory (PYSOURCES),
# there should be a matching .html file in Code_Documentation.
# The % means the stem, for example world.py has a stem of 'world' so we
# make world.html from world.py
DOCUMENTS_NEEDED_BASE=$(PYSOURCES:%.py=docs/literate/%.html)
# For subdirectories, we'll get the subdirectory as a prefix
# for example, svrsub/svrconfig
DOCUMENTS_NEEDED_LIB=$(PYLIBSOURCES:%.py=docs/literate/%.html)
DOCUMENTS_NEEDED_EXTRA=$(PYEXTRASOURCES:%.py=docs/literate/%.html)
DOCUMENTS_NEEDED_EXTRAS=$(PYEXTRASSOURCES:%.py=docs/literate/%.html)
DOCUMENTS_NEEDED_TEST=$(PYTESTSSOURCES:%.py=docs/literate/%.html)
DOCUMENTS_NEEDED_WIDGETS=$(PYWIDGETSOURCES:%.py=docs/literate/%.html)
.PHONY: literate_docs
# No such file as all so mark it as a phony
.PHONY: base_docs
.PHONY: lib_docs
.PHONY: extra_docs
.PHONY: extras_docs
.PHONY: test_docs
.PHONY: widget_docs
base_docs: $(DOCUMENTS_NEEDED_BASE)
lib_docs: $(DOCUMENTS_NEEDED_LIB)
extra_docs: $(DOCUMENTS_NEEDED_EXTRA)
extras_docs: $(DOCUMENTS_NEEDED_EXTRAS)
test_docs: $(DOCUMENTS_NEEDED_TEST)
widget_docs: $(DOCUMENTS_NEEDED_WIDGETS)
literate_docs: base_docs lib_docs extra_docs extras_docs test_docs widget_docs
# The html file in docs/literate (and its cousins) depends upon the py file of the same name
# If the html file is missing or older than the python one, run the pycco command
# for the file (in $<)
docs/literate/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/extras/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/lib/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/lib/data/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/lib/extra/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/lib/test/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
docs/literate/lib/widgets/%.html: %.py
$(PYCCO_ONE) ./docs/literate $<
# Call 'make index' to make the full documentation
.PHONY: literate_index
literate_index:
make literate_clean
$(PYCCO_ALL) ./docs/literate $(PYSOURCES)
.PHONY: literate_clean
literate_clean:
rm -rf docs/literate/