~vcs-imports/trac/trunk

8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
1
# == Makefile for Trac related tasks
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
2
#
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
3
# Automating testing, l10n tasks, documentation generation, ... see HELP below
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
4
# ----------------------------------------------------------------------------
5430 by cboos
Makefile: improve the help and add l10n related targets.
5
#
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
6
# Note about customization:
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
7
#
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
8
#   No changes to the present Makefile should be necessary,
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
9
#   configuration should take place in the Makefile.cfg file.
10
#
11
#   Copy Makefile.cfg.sample to Makefile.cfg and adapt it
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
12
#   to match your local environment.
5981 by cboos
Resume work on generating the API documentation (#8695).
13
#
14
# Note that this is a GNU Makefile, nmake and other abominations are
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
15
# not supported. On Windows, you can use it from a msys2 shell, like
16
# the one that comes part of https://git-for-windows.github.io.
5981 by cboos
Resume work on generating the API documentation (#8695).
17
#
18
# ============================================================================
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
19
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
20
define HELP
21
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
22
 The Trac Makefile is here to help automate development and
23
 maintenance tasks.
24
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
25
 Please use `make <target>' where <target> is one of:
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
26
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
27
  clean               delete all compiled files
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
28
  status              show which Python is used and other infos
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
29
30
  [python=...]        variable for selecting Python version
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
31
  [pythonopts=...]    variable containing extra options for the interpreter
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
32
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
33
 As there are many more tasks available, you can ask for specific help:
34
35
  help-code           tasks for checking the code style
36
  help-testing        tasks and configuration parameters for testing
37
  help-server         tasks and configuration for starting tracd
38
  help-l10n           tasks and configuration for L10N maintenance
39
  help-doc            tasks and configuration for preparing Trac documentation
40
  help-release        tasks and configuration for preparing a Trac release
41
  help-misc           several other tasks
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
42
8604 by cboos
1.3.2dev: merge [15390] from 1.2-stable (Makefile and AppVeyor)
43
  help-all            all the tasks at a glance...
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
44
endef
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
45
# `
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
46
export HELP
47
5911 by cboos
make help: warn about missing Makefile.cfg
48
define HELP_CFG
49
 It looks like you don't have a Makefile.cfg file yet.
50
 You can get started by doing `cp Makefile.cfg.sample Makefile.cfg'
51
 and then adapt it to your environment.
52
endef
53
export HELP_CFG
54
5981 by cboos
Resume work on generating the API documentation (#8695).
55
# ============================================================================
56
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
57
# ----------------------------------------------------------------------------
5486 by cboos
Makefile: reworked `coverage` target.
58
#
59
# Main targets
5981 by cboos
Resume work on generating the API documentation (#8695).
60
#
61
# ----------------------------------------------------------------------------
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
62
8604 by cboos
1.3.2dev: merge [15390] from 1.2-stable (Makefile and AppVeyor)
63
.PHONY: all help help-all status clean clean-bytecode clean-mo
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
64
7734 by rjollos
1.1.4dev: Merged [13851] from 1.0-stable. Refs #11316, #11437.
65
%.py : status
9561 by rjollos
1.4dev: Call `unittest` module from Makefile
66
	$(PYTHON) -m unittest $(testopts) $(subst /,.,$(@:.py=)).test_suite
7734 by rjollos
1.1.4dev: Merged [13851] from 1.0-stable. Refs #11316, #11437.
67
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
68
ifdef test
69
all: status
9561 by rjollos
1.4dev: Call `unittest` module from Makefile
70
	$(PYTHON) -m unittest $(testopts) $(subst /,.,$(test:.py=)).test_suite
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
71
else
5430 by cboos
Makefile: improve the help and add l10n related targets.
72
all: help
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
73
endif
74
5911 by cboos
make help: warn about missing Makefile.cfg
75
help: Makefile.cfg
5450 by cboos
Makefile: only use one `echo` for the usage information (`make` or `make help`).
76
	@echo "$$HELP"
5430 by cboos
Makefile: improve the help and add l10n related targets.
77
8604 by cboos
1.3.2dev: merge [15390] from 1.2-stable (Makefile and AppVeyor)
78
help_variables = $(filter HELP_%,$(.VARIABLES))
79
help_targets = $(filter-out help-CFG,$(help_variables:HELP_%=help-%))
80
81
.SECONDEXPANSION:
82
help-all: $$(sort $$(help_targets))
83
84
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
85
help-%: Makefile.cfg
86
	@echo "$${HELP_$*}"
5911 by cboos
make help: warn about missing Makefile.cfg
87
88
Makefile.cfg:
89
	@echo "$$HELP_CFG"
90
4640 by cboos
0.12dev: merged [8189:8193/sandbox/rework-testing], alternate db backend for unit-tests and Makefile improvements.
91
status:
7367 by cboos
1.1.3dev: merged r13251 from 1.0-stable (`make status` improvements)
92
	@echo
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
93
	@echo "Python: $$(which $(PYTHON)) $(pythonopts)"
7453 by cboos
1.1.3dev: merged [13412] from 1.0-stable (`figleaf` and `coverage` in `make status`)
94
	@echo
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
95
	@$(PYTHON) contrib/make_status.py
7367 by cboos
1.1.3dev: merged r13251 from 1.0-stable (`make status` improvements)
96
	@echo
97
	@echo "Variables:"
8275 by cboos
1.2dev: Merge [14760] from 1.0-stable (#12476)
98
	@echo "  PATH=$$PATH"
99
	@echo "  PYTHONPATH=$$PYTHONPATH"
7367 by cboos
1.1.3dev: merged r13251 from 1.0-stable (`make status` improvements)
100
	@echo "  TRAC_TEST_DB_URI=$$TRAC_TEST_DB_URI"
101
	@echo "  server-options=$(server-options)"
102
	@echo
103
	@echo "External dependencies:"
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
104
	@printf "  Git version: "
7367 by cboos
1.1.3dev: merged r13251 from 1.0-stable (`make status` improvements)
105
	@git --version 2>/dev/null || echo "not installed"
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
106
	@printf "  Subversion version: "
8275 by cboos
1.2dev: Merge [14760] from 1.0-stable (#12476)
107
	@svn --version -q 2>/dev/null || echo "not installed"
7453 by cboos
1.1.3dev: merged [13412] from 1.0-stable (`figleaf` and `coverage` in `make status`)
108
	@echo
4557 by thatch
Add Makefile: run 'make test' or 'make coverage' for full suite
109
5486 by cboos
Makefile: reworked `coverage` target.
110
Trac.egg-info: status
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
111
	$(PYTHON) setup.py egg_info
5486 by cboos
Makefile: reworked `coverage` target.
112
8551 by cboos
1.3.2dev: merge [15285] from 1.2-stable (fix `make clean`)
113
clean: clean-bytecode clean-coverage clean-doc
5486 by cboos
Makefile: reworked `coverage` target.
114
115
clean-bytecode:
7834 by rjollos
1.1.5dev: Merged [14007] from 1.0-stable. Refs #12037.
116
	find . -name \*.py[co] -exec rm {} \;
5486 by cboos
Makefile: reworked `coverage` target.
117
5911 by cboos
make help: warn about missing Makefile.cfg
118
Makefile: ;
4613 by cboos
0.12dev: merged rework-testing branch [8000:8130/sandbox/rework-testing]
119
5464 by cboos
Makefile: added a `make server` target for running tracd.
120
# ----------------------------------------------------------------------------
5486 by cboos
Makefile: reworked `coverage` target.
121
#
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
122
# Copy Makefile.cfg.sample to Makefile.cfg and adapt to your local
8598 by cboos
1.3.2dev: a few grammar fixes in the Makefile
123
# environment, no customization of the present Makefile should be
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
124
# necessary.
125
#
126
#
5464 by cboos
Makefile: added a `make server` target for running tracd.
127
-include Makefile.cfg
5486 by cboos
Makefile: reworked `coverage` target.
128
#
129
# ----------------------------------------------------------------------------
130
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
131

5486 by cboos
Makefile: reworked `coverage` target.
132
# ----------------------------------------------------------------------------
133
#
5430 by cboos
Makefile: improve the help and add l10n related targets.
134
# L10N related tasks
5981 by cboos
Resume work on generating the API documentation (#8695).
135
#
136
# ----------------------------------------------------------------------------
5430 by cboos
Makefile: improve the help and add l10n related targets.
137
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
138
define HELP_l10n
139
140
 ---------------- L10N tasks
141
142
  init-xy             create catalogs for given xy locale
143
144
  extraction          regenerate the catalog templates
145
146
  update              update all the catalog files from the templates
147
  update-xy           update the catalogs for the xy locale only
9611 by rjollos
1.5.1dev: Merge r17206 from 1.4-stable
148
  [updateopts=...]    variable containing extra options for update (e.g. -N)
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
149
150
  compile             compile all the catalog files
151
  compile-xy          compile the catalogs for the xy locale only
152
153
  check               verify all the catalog files
154
  check-xy            verify the catalogs for the xy locale only
155
156
  stats               detailed translation statistics for all catalogs
157
  stats-pot           total messages in the catalog templates
158
  stats-xy            translated, fuzzy, untranslated for the xy locale only
159
160
  summary             display percent translated for all catalogs
161
  summary-xy          display percent translated for the xy locale only
162
                      (suitable for a commit message)
163
9606 by jomae
1.5.1dev: merge [17190] from 1.4-stable
164
  tx-merge            merge catalogs from Transifex for all locales
165
  tx-merge-xy         merge catalogs from Transifex for the xy locale only
166
9611 by rjollos
1.5.1dev: Merge r17206 from 1.4-stable
167
  xdiff               show changes to message strings for all catalogs
168
  xdiff-pot           show changes to message strings in the catalog template
169
  xdiff-xy            show changes to message strings for the xy locale
170
171
  diff                show summarized changes after an update for all catalogs
172
  diff-xy             show summarized changes after an update for the xy locale
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
173
  [vc=...]            variable containing the version control command to use
174
175
  [locale=...]        variable for selecting a set of locales
176
177
endef
178
export HELP_l10n
179
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
180
catalogs = messages messages-js tracini
181
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
182
ifdef locale
183
    locales = $(locale)
184
else
185
    locales = $(wildcard trac/locale/*/LC_MESSAGES/messages.po)
186
    locales := $(subst trac/locale/,,$(locales))
187
    locales := $(subst /LC_MESSAGES/messages.po,,$(locales))
5656 by cboos
Makefile: clean-up `summary` targets.
188
    locales := $(sort $(locales))
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
189
endif
190
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
191
# Note: variables only valid within a $(foreach catalog,...) evaluation
192
catalog.po = trac/locale/$(*)/LC_MESSAGES/$(catalog).po
193
catalog.pot = trac/locale/$(catalog).pot
194
catalog_stripped = $(subst messages,,$(subst -,,$(catalog)))
195
_catalog = $(if $(catalog_stripped),_)$(catalog_stripped)
5641 by cboos
Makefile: `make summary` calls `make summary-<locale>` for every locales or for those listed in the `locale` command line variable.
196
5686 by cboos
Makefile: added `diff-xy` targets, in order to see only the meaningful changes after an `update-xy`.
197
.PHONY: extract extraction update compile check stats summary diff
5430 by cboos
Makefile: improve the help and add l10n related targets.
198
6607 by rblank
1.1dev: Merged from 1.0-stable.
199
5713 by cboos
Makefile: updated L10N tasks to take into account the catalogs dedicated to the messages in Javascript files (#6353).
200
init-%:
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
201
	@$(foreach catalog,$(catalogs), \
202
	    [ -e $(catalog.po) ] \
203
	    && echo "$(catalog.po) already exists" \
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
204
	    || $(PYTHON) setup.py init_catalog$(_catalog) -l $(*);)
5713 by cboos
Makefile: updated L10N tasks to take into account the catalogs dedicated to the messages in Javascript files (#6353).
205
6607 by rblank
1.1dev: Merged from 1.0-stable.
206
5452 by cboos
Makefile: `make extraction` sounds better than `make extract`, add it as synonym.
207
extract extraction:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
208
	$(PYTHON) setup.py $(foreach catalog,$(catalogs),\
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
209
	    extract_messages$(_catalog))
5430 by cboos
Makefile: improve the help and add l10n related targets.
210
6607 by rblank
1.1dev: Merged from 1.0-stable.
211
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
212
update-%:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
213
	$(PYTHON) setup.py $(foreach catalog,$(catalogs), \
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
214
	    update_catalog$(_catalog) -l $(*)) $(updateopts)
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
215
216
ifdef locale
217
update: $(addprefix update-,$(locale))
218
else
5430 by cboos
Makefile: improve the help and add l10n related targets.
219
update:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
220
	$(PYTHON) setup.py $(foreach catalog,$(catalogs), \
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
221
	    update_catalog$(_catalog)) $(updateopts)
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
222
endif
223
6607 by rblank
1.1dev: Merged from 1.0-stable.
224
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
225
compile-%:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
226
	$(PYTHON) setup.py $(foreach catalog,$(catalogs), \
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
227
	    compile_catalog$(_catalog) -l $(*)) \
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
228
	    generate_messages_js -l $(*)
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
229
230
ifdef locale
231
compile: $(addprefix compile-,$(locale))
232
else
5430 by cboos
Makefile: improve the help and add l10n related targets.
233
compile:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
234
	$(PYTHON) setup.py $(foreach catalog,$(catalogs), \
6902 by jomae
1.1.2dev: merged [12361] from 1.0-stable
235
	    compile_catalog$(_catalog)) generate_messages_js
5453 by cboos
Makefile: add `update-xy` and `compile-xy` targets, for symmetry with `check-xy` and `stats-xy`.
236
endif
5430 by cboos
Makefile: improve the help and add l10n related targets.
237
6607 by rblank
1.1dev: Merged from 1.0-stable.
238
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
239
check: pre-check $(addprefix check-,$(locales))
5479 by cboos
Makefile: and again... actually the direct `make -k check` works as expected, no need for tricks.
240
	@echo "All catalogs checked are OK"
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
241
242
pre-check:
243
	@echo "checking catalogs for $(locales)..."
244
245
check-%:
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
246
	@printf "$(@): "
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
247
	$(PYTHON) setup.py $(foreach catalog,$(catalogs), \
6501 by jomae
1.0dev: merged [11230] from 0.12-stable and added `check_catalog_tracini` command
248
	    check_catalog$(_catalog) -l $(*))
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
249
	@$(foreach catalog,$(catalogs), \
250
	    msgfmt --check $(catalog.po) &&) echo msgfmt OK
251
	@rm -f messages.mo
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
252
6607 by rblank
1.1dev: Merged from 1.0-stable.
253
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
254
stats: pre-stats $(addprefix stats-,$(locales))
255
256
pre-stats: stats-pot
257
	@echo "translation statistics for $(locales)..."
258
259
stats-pot:
5713 by cboos
Makefile: updated L10N tasks to take into account the catalogs dedicated to the messages in Javascript files (#6353).
260
	@echo "translation statistics for catalog templates:"
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
261
	@$(foreach catalog,$(catalogs), \
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
262
	    printf "$(catalog.pot): "; \
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
263
	    msgfmt --statistics $(catalog.pot);)
264
	@rm -f messages.mo
5431 by cboos
Makefile: added L10N ''check'' and ''stats'' targets.
265
266
stats-%:
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
267
	@$(foreach catalog,$(catalogs), \
268
	    [ -e $(catalog.po) ] \
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
269
	    && { printf "$(catalog.po): "; \
6522 by cboos
l10n: fix `stats-{language code}` rule in Makefile
270
	         msgfmt --statistics $(catalog.po); } \
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
271
	    || echo "$(catalog.po) doesn't exist (make init-$(*))";)
272
	@rm -f messages.mo
5641 by cboos
Makefile: `make summary` calls `make summary-<locale>` for every locales or for those listed in the `locale` command line variable.
273
6607 by rblank
1.1dev: Merged from 1.0-stable.
274
5656 by cboos
Makefile: clean-up `summary` targets.
275
summary: $(addprefix summary-,$(locales))
276
277
define untranslated-sh
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
278
LC_ALL=C msgfmt --statistics $(catalog.pot) 2>&1 \
5656 by cboos
Makefile: clean-up `summary` targets.
279
  | tail -1 \
280
  | sed -e 's/0 translated messages, \([0-9]*\) un.*/\1/'
281
endef
282
283
define translated-sh
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
284
{ LC_ALL=C msgfmt --statistics $(catalog.po) 2>&1 || echo 0; } \
5656 by cboos
Makefile: clean-up `summary` targets.
285
    | tail -1 \
286
    | sed -e 's/[^0-9]*\([0-9]*\) translated.*/\1/'
287
endef
288
289
MESSAGES_TOTAL = \
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
290
    $(eval MESSAGES_TOTAL := ($(foreach catalog,$(catalogs), \
291
                                  $(shell $(untranslated-sh)) + ) 0)) \
5656 by cboos
Makefile: clean-up `summary` targets.
292
    $(MESSAGES_TOTAL)
293
294
summary-%:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
295
	@$(PYTHON) -c "print('l10n/$(*): translations updated (%d%%)' \
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
296
	    % (($(foreach catalog,$(catalogs), \
297
	          $(shell $(translated-sh)) + ) 0) * 100.0 \
7919 by rjollos
1.1.6dev: Replace `print` statement with `print` function. Refs #12047.
298
	       / $(MESSAGES_TOTAL)))"
6136 by cboos
Makefile: for i18n tasks, iterate over list of //catalogs//.
299
	@rm -f messages.mo
5640 by cboos
Makefile: added summary-<locale> target for preparing commit message.
300
6607 by rblank
1.1dev: Merged from 1.0-stable.
301
9606 by jomae
1.5.1dev: merge [17190] from 1.4-stable
302
tx-merge-%:
303
	@$(foreach catalog,$(catalogs), \
304
	    touch $(catalog.po); \
305
	    mv $(catalog.po) $(catalog.po).orig; \
306
	)
307
	@tx pull --force --no-interactive -l $(*)
308
	@$(foreach catalog,$(catalogs), \
309
	    [ -f $(catalog.po) ] && mv $(catalog.po) $(catalog.po).tx; \
310
	    mv $(catalog.po).orig $(catalog.po); \
311
	    [ -f $(catalog.po).tx ] && { \
312
	        $(PYTHON) contrib/merge_catalog.py $(catalog) $(catalog.po).tx $(*); \
313
	        rm $(catalog.po).tx; \
314
	    }; \
315
	)
316
317
tx-merge: $(addprefix tx-merge-,$(filter-out en_US,$(locales)))
318
319
5686 by cboos
Makefile: added `diff-xy` targets, in order to see only the meaningful changes after an `update-xy`.
320
diff: $(addprefix diff-,$(locales))
321
9606 by jomae
1.5.1dev: merge [17190] from 1.4-stable
322
ifndef vc
323
ifneq "$(wildcard $(CURDIR)/.svn)" ""
324
    vc := svn
325
else ifneq "$(wildcard $(CURDIR)/.git)" ""
326
    vc := git
327
else ifneq "$(wildcard $(CURDIR)/.hg)" ""
328
    vc := hg
329
endif
330
endif
331
332
define vc_cat-svn
333
    $(vc) cat -rBASE $(1)
334
endef
335
define vc_cat-git
336
    $(vc) show HEAD:$(1)
337
endef
338
define vc_cat-hg
339
    $(vc) cat -r. $(1)
340
endef
341
define vc_cat
342
    $(call vc_cat-$(vc),$(1))
343
endef
344
345
define xdiff_catalog
346
    { \
347
        $(call vc_cat,$(1)) \
348
            | msgcat --no-wrap --no-location -s -i - >$(1).tmp; \
349
        msgcat --no-wrap --no-location -s -i - <$(1) \
350
            | diff -u -L $(1) -L $(1) $(1).tmp - || :; \
351
        rm -- $(1).tmp; \
352
    }
353
endef
354
355
356
xdiff-pot:
357
	@$(foreach catalog,$(catalogs), \
358
	    $(call xdiff_catalog,$(catalog.pot)); \
359
	)
360
361
xdiff-%:
362
	@$(foreach catalog,$(catalogs), \
363
	    $(call xdiff_catalog,$(catalog.po)); \
364
	)
365
366
xdiff: $(addprefix xdiff-,$(locales))
5686 by cboos
Makefile: added `diff-xy` targets, in order to see only the meaningful changes after an `update-xy`.
367
368
diff-%:
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
369
	@diff=l10n-$(*).diff; \
370
	$(vc) diff trac/locale/$(*) > $$diff; \
371
	[ -s $$diff ] && { \
8415 by rjollos
1.3.1dev: Merge r14989 from 1.2-stable
372
	    printf "# $(*) changed -> "; \
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
373
	    $(PYTHON) contrib/l10n_diff_index.py $$diff; \
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
374
	} || rm $$diff
5713 by cboos
Makefile: updated L10N tasks to take into account the catalogs dedicated to the messages in Javascript files (#6353).
375
8598 by cboos
1.3.2dev: a few grammar fixes in the Makefile
376
# The above creates l10n-xy.diff files but also a l10n-xy.diff.index
6639 by cboos
1.1.1dev: merge l10n_*.py scripts from 1.0-stable
377
# file pointing to "interesting" diffs (message changes or addition
378
# for valid msgid).
379
#
380
# See also contrib/l10n_sanitize_diffs.py, which removes in-file
381
# *conflicts* for line change only.
6607 by rblank
1.1dev: Merged from 1.0-stable.
382
5838 by cboos
Makefile: add ''clean-mo'' target for removing compiled catalogs.
383
clean-mo:
384
	find trac/locale -name \*.mo -exec rm {} \;
385
	find trac/htdocs/js/messages -name \*.js -exec rm {} \;
386
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
387

5486 by cboos
Makefile: reworked `coverage` target.
388
# ----------------------------------------------------------------------------
389
#
6190 by rblank
0.13dev: Added a `pylint` make target.
390
# Code checking tasks
391
#
392
# ----------------------------------------------------------------------------
393
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
394
define HELP_code
395
396
 ---------------- Code checking tasks
397
398
  pylint              check code with pylint
8615 by cboos
(#12639) tooling (jinjachecker)
399
  jinja               check Jinja2 templates
8710 by cboos
1.3.2dev: add `make coffee` target
400
  coffee              compile .coffee script files into .js files
401
9001 by rjollos
1.3.2dev: Merge r16033 from 1.2-stable
402
  [module=...]        module or package to check with pylint
8710 by cboos
1.3.2dev: add `make coffee` target
403
  [templates=...]     list of Jinja2 templates to check
404
  [coffeescripts=...] list of coffee script files to compile
9659 by rjollos
1.5.1dev: Merge r17335 from 1.4-stable
405
  [jinjaopts=]        list of options for jinja checker
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
406
407
endef
408
export HELP_code
6190 by rblank
0.13dev: Added a `pylint` make target.
409
8710 by cboos
1.3.2dev: add `make coffee` target
410
.PHONY: pylint jinja coffee
8615 by cboos
(#12639) tooling (jinjachecker)
411
9001 by rjollos
1.3.2dev: Merge r16033 from 1.2-stable
412
pylintopts = --persistent=n --init-import=y \
413
--disable=E0102,E0211,E0213,E0602,E0611,E1002,E1101,E1102,E1103 \
414
--disable=F0401 \
415
--disable=W0102,W0141,W0142,W0201,W0212,W0221,W0223,W0231,W0232, \
416
--disable=W0401,W0511,W0603,W0613,W0614,W0621,W0622,W0703 \
417
--disable=C0103,C0111 \
418
419
ifdef module
420
pylint:
421
	pylint $(pylintopts) $(subst /,.,$(module:.py=))
422
else
423
pylint:
424
	pylint $(pylintopts) trac tracopt
425
endif
6190 by rblank
0.13dev: Added a `pylint` make target.
426
8615 by cboos
(#12639) tooling (jinjachecker)
427
8665 by cboos
Fix `make jinja`, as we can no longer rely on the j* pattern for Jinja2 templates
428
templates ?= $(shell \
8677 by cboos
(#12639) eliminate HTML tags from text sources in the templates
429
    find $$(find trac tracopt -type d -a -name templates) \
430
        -mindepth 1 -maxdepth 1 -type f | \
8665 by cboos
Fix `make jinja`, as we can no longer rely on the j* pattern for Jinja2 templates
431
    grep -v "~" | grep -v README )
8615 by cboos
(#12639) tooling (jinjachecker)
432
433
jinja:
8710 by cboos
1.3.2dev: add `make coffee` target
434
	$(PYTHON) contrib/jinjachecker.py $(jinjaopts) $(templates)
435
436
coffeescripts ?= $(shell find trac tracopt -name \*.coffee)
9398 by rjollos
1.3.4dev: Check CoffeeScript major version
437
coffeescript_major_version ?= \
438
    $(shell coffee -v 2> /dev/null | \
439
        sed -E s'/CoffeeScript version ([0-9]+)\.[0-9]+\.[0-9]+/\1/')
8710 by cboos
1.3.2dev: add `make coffee` target
440
441
coffee:
9398 by rjollos
1.3.4dev: Check CoffeeScript major version
442
ifneq "$(coffeescript_major_version)" "1"
443
	$(error "CoffeeScript version 1.x is required")
444
endif
445
	coffee -c $(coffeescripts)
8615 by cboos
(#12639) tooling (jinjachecker)
446
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
447

448
# ----------------------------------------------------------------------------
449
#
450
# Testing related tasks
451
#
452
# ----------------------------------------------------------------------------
453
454
define HELP_testing
455
456
 ---------------- Testing tasks
457
458
  unit-test           run unit tests
459
  functional-test     run functional tests
460
  test-wiki           shortcut for running all wiki unit tests
461
  test                run all tests
462
  coverage            run all tests, under coverage
463
464
  [db=...]            variable for selecting database backend
465
  [test=...]          variable for selecting a single test file
466
  [testopts=...]      variable containing extra options for running tests
467
  [coverageopts=...]  variable containing extra options for coverage
468
469
endef
470
export HELP_testing
471
472
.PHONY: test unit-test functional-test test-wiki
473
474
test: unit-test functional-test
475
476
unit-test: Trac.egg-info
9561 by rjollos
1.4dev: Call `unittest` module from Makefile
477
	SKIP_FUNCTIONAL_TESTS=1 $(PYTHON) -m unittest $(testopts) trac.test.test_suite
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
478
479
functional-test: Trac.egg-info
9561 by rjollos
1.4dev: Call `unittest` module from Makefile
480
	$(PYTHON) -m unittest $(testopts) trac.tests.functional.test_suite
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
481
482
test-wiki:
9561 by rjollos
1.4dev: Call `unittest` module from Makefile
483
	$(PYTHON) -m unittest $(testopts) trac.tests.allwiki.test_suite
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
484
6190 by rblank
0.13dev: Added a `pylint` make target.
485
# ----------------------------------------------------------------------------
486
#
5486 by cboos
Makefile: reworked `coverage` target.
487
# Coverage related tasks
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
488
#
489
# (see http://nedbatchelder.com/code/coverage/)
5981 by cboos
Resume work on generating the API documentation (#8695).
490
#
491
# ----------------------------------------------------------------------------
5486 by cboos
Makefile: reworked `coverage` target.
492
7454 by cboos
1.1.3dev: merged [13415] from 1.0-stable (fix `make coverage`)
493
COVERAGEOPTS ?= --branch --source=trac,tracopt
494
5486 by cboos
Makefile: reworked `coverage` target.
495
.PHONY: coverage clean-coverage show-coverage
496
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
497
coverage: clean-coverage test-coverage show-coverage
5486 by cboos
Makefile: reworked `coverage` target.
498
499
clean-coverage:
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
500
	coverage erase
501
	@rm -fr htmlcov
502
5657 by cboos
Makefile: `coverage` target respects `test=<path/to/tests/script.py` for looking at coverage of a specific test file.
503
ifdef test
504
test-coverage:
6038 by cboos
0.13dev: merge changes from 0.12-stable
505
	coverage run $(test) $(testopts)
5657 by cboos
Makefile: `coverage` target respects `test=<path/to/tests/script.py` for looking at coverage of a specific test file.
506
else
9687 by rjollos
1.5.2dev: Merge r17383 from 1.4-stable
507
test-coverage: unit-test-coverage
5657 by cboos
Makefile: `coverage` target respects `test=<path/to/tests/script.py` for looking at coverage of a specific test file.
508
endif
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
509
510
unit-test-coverage:
7454 by cboos
1.1.3dev: merged [13415] from 1.0-stable (fix `make coverage`)
511
	coverage run -a $(coverageopts) $(COVERAGEOPTS) \
512
	    trac/test.py --skip-functional-tests $(testopts)
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
513
514
show-coverage: htmlcov/index.html
7454 by cboos
1.1.3dev: merged [13415] from 1.0-stable (fix `make coverage`)
515
	$(if $(START),$(START) $(<))
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
516
517
htmlcov/index.html:
7454 by cboos
1.1.3dev: merged [13415] from 1.0-stable (fix `make coverage`)
518
	coverage html --omit=*/__init__.py
5492 by cboos
Makefile: switching `make coverage` to use Ned Batchelder's excellent [http://nedbatchelder.com/code/coverage/ coverage.py] system, instead of figleaf.
519
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
520

5486 by cboos
Makefile: reworked `coverage` target.
521
# ----------------------------------------------------------------------------
522
#
5464 by cboos
Makefile: added a `make server` target for running tracd.
523
# Tracd related tasks
5981 by cboos
Resume work on generating the API documentation (#8695).
524
#
525
# ----------------------------------------------------------------------------
5464 by cboos
Makefile: added a `make server` target for running tracd.
526
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
527
define HELP_server
528
529
 ---------------- Standalone test server
530
531
  [start-]server      start tracd
532
533
  [port=...]          variable for selecting the port
534
  [auth=...]          variable for specifying authentication
535
  [env=...]           variable for the trac environment or parent dir
536
  [tracdopts=...]     variable containing extra options for tracd
537
538
endef
539
export HELP_server
540
5464 by cboos
Makefile: added a `make server` target for running tracd.
541
port ?= 8000
542
tracdopts ?= -r
543
544
define server-options
545
 $(if $(port),-p $(port))\
546
 $(if $(auth),-a '$(auth)')\
547
 $(tracdopts)\
548
 $(if $(wildcard $(env)/VERSION),$(env),-e $(env))
549
endef
550
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
551
.PHONY: server start-server tracd start-tracd
552
553
server tracd start-tracd: start-server
554
555
start-server: Trac.egg-info
5464 by cboos
Makefile: added a `make server` target for running tracd.
556
ifdef env
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
557
	$(PYTHON) trac/web/standalone.py $(server-options)
5464 by cboos
Makefile: added a `make server` target for running tracd.
558
else
559
	@echo "\`env' variable was not specified. See \`make help'."
560
endif
5430 by cboos
Makefile: improve the help and add l10n related targets.
561
5981 by cboos
Resume work on generating the API documentation (#8695).
562
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
563

564
# ----------------------------------------------------------------------------
565
#
566
# Miscellaneous tasks
567
#
568
# ----------------------------------------------------------------------------
569
570
define HELP_misc
571
 ---------------- Miscellaneous
572
573
  start-admin         start trac-admin (on `env')
574
  start-python        start the Python interpreter
575
576
  [adminopts=...]     variable containing extra options for trac-admin
577
578
endef
579
# ` (keep emacs font-lock happy)
580
export HELP_misc
581
582
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
583
.PHONY: trac-admin start-admin
584
585
trac-admin: start-admin
586
587
start-admin:
588
ifneq "$(wildcard $(env)/VERSION)" ""
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
589
	@$(PYTHON) trac/admin/console.py $(env) $(adminopts)
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
590
else
591
	@echo "\`env' variable was not specified or doesn't point to one env."
592
endif
593
594
595
.PHONY: start-python
596
597
start-python:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
598
	@$(PYTHON)
6817 by cboos
1.1.2dev: merged Makefile enhancements from 1.0-stable
599
# (this doesn't seem to be much, but we're taking benefit of the
600
# environment setup we're doing below)
601
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
602

5981 by cboos
Resume work on generating the API documentation (#8695).
603
# ----------------------------------------------------------------------------
604
#
605
# Documentation related tasks
606
#
607
# ----------------------------------------------------------------------------
608
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
609
define HELP_doc
610
611
 ---------------- Documentation tasks
612
613
  apidoc|sphinx       generate the Sphinx documentation (all specified formats)
614
  apidoc-html         generate the Sphinx documentation in HTML format
615
  apidoc-pdf          generate the Sphinx documentation in PDF format
616
  apidoc-check        check for missing symbols in Sphinx documentation
8728 by cboos
1.3.2dev: merge [15545,15546] from 1.2-stable (TracDev/ApiDocs)
617
  apidoc-coverage     generate coverage information for Sphinx documentation
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
618
619
  apiref|epydoc       generate the full API reference using Epydoc
620
621
  [sphinxformat=...]  list of formats for generated documentation
622
  [sphinxopts=...]    variable containing extra options for Sphinx
623
  [sphinxopts-html=...] variable containing extra options used for html format
624
  [epydocopts=...]    variable containing extra options for Epydoc
625
  [dotpath=/.../dot]  path to Graphviz dot program (not used yet)
626
endef
627
export HELP_doc
628
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
629
.PHONY: apidoc sphinx apidoc-check apiref epydoc clean-doc
5981 by cboos
Resume work on generating the API documentation (#8695).
630
631
# We also try to honor the "conventional" environment variables used by Sphinx
632
sphinxopts ?= $(SPHINXOPTS)
633
SPHINXBUILD ?= sphinx-build
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
634
BUILDDIR ?= build/doc
5981 by cboos
Resume work on generating the API documentation (#8695).
635
PAPER ?= a4
636
sphinxopts-latex ?= -D latex_paper_size=$(PAPER)
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
637
sphinxformat = html
5981 by cboos
Resume work on generating the API documentation (#8695).
638
5985 by cboos
#8695: add support for alternate API reference using [http://epydoc.sourceforge.net/ Epydoc].
639
sphinx: apidoc
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
640
apidoc: $(addprefix apidoc-,$(sphinxformat))
641
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
642
apidoc-check:
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
643
	@$(PYTHON) doc/utils/checkapidoc.py
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
644
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
645
apidoc-%:
646
	@$(SPHINXBUILD) -b $(*) \
647
	    $(sphinxopts) $(sphinxopts-$(*)) \
5981 by cboos
Resume work on generating the API documentation (#8695).
648
	    -d build/doc/doctree \
6014 by cboos
Makefile: one can build the Sphinx doc for all formats in one go.
649
	    doc $(BUILDDIR)/$(*)
8728 by cboos
1.3.2dev: merge [15545,15546] from 1.2-stable (TracDev/ApiDocs)
650
	@$(if $(findstring coverage,$(*)),\
651
	    diff -u doc/utils/python.txt $(BUILDDIR)/coverage/python.txt)
5981 by cboos
Resume work on generating the API documentation (#8695).
652
5985 by cboos
#8695: add support for alternate API reference using [http://epydoc.sourceforge.net/ Epydoc].
653
654
epydoc: apiref
655
apiref: doc-images
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
656
	@$(PYTHON) doc/utils/runepydoc.py --config=doc/utils/epydoc.conf \
5985 by cboos
#8695: add support for alternate API reference using [http://epydoc.sourceforge.net/ Epydoc].
657
	    $(epydocopts) $(if $(dotpath),--dotpath=$(dotpath))
658
659
doc-images: $(addprefix build/,$(wildcard doc/images/*.png))
660
build/doc/images/%: doc/images/% | build/doc/images
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
661
	@cp $(<) $(@)
5985 by cboos
#8695: add support for alternate API reference using [http://epydoc.sourceforge.net/ Epydoc].
662
build/doc/images:
663
	@mkdir -p $(@)
664
5981 by cboos
Resume work on generating the API documentation (#8695).
665
clean-doc:
5985 by cboos
#8695: add support for alternate API reference using [http://epydoc.sourceforge.net/ Epydoc].
666
	rm -fr build/doc
667
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
668

669
# ----------------------------------------------------------------------------
670
#
671
# Release related tasks
672
#
673
# ----------------------------------------------------------------------------
674
675
define HELP_release
676
677
 ---------------- Release tasks
678
679
  release             release-exe on Windows, release-src otherwise
8995 by rjollos
1.3.2dev: Merge r16015 from 1.2-stable
680
  release-src         generate the .tar.gz and .whl packages
8598 by cboos
1.3.2dev: a few grammar fixes in the Makefile
681
  release-exe         generate the Windows installers (32- and 64-bits)
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
682
  release-clean       remove the packages
683
9399 by rjollos
1.3.4dev: Merge r16797 from 1.2-stable
684
  update-help         fetches latest help/guide from Edgewall
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
685
  update-copyright    update copyright year in file headers
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
686
  checksum            MD5 and SHA1 checksums of packages of given version
687
  upload              scp the packages of given version to user@lynx:~/dist
688
689
  [version=...]       version number, mandatory for checksum and upload
9399 by rjollos
1.3.4dev: Merge r16797 from 1.2-stable
690
  [prefix=...]        wiki page prefix for update-help
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
691
endef
692
export HELP_release
693
694
.PHONY: release release-src wheel dist release-exe wininst
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
695
.PHONY: release-clean checksum update-copyright update-help upload
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
696
697
ifeq "$(OS)" "Windows_NT"
698
release: release-exe
699
else # !Windows_NT
700
release: release-src
701
endif # Windows_NT
702
9397 by rjollos
1.3.4dev: Merge r16792 from 1.2-stable
703
release-clean:
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
704
ifeq "$(version)" ""
705
	$(error "specify version= on the make command-line")
706
else
707
	@rm $(sdist+wheel) $(wininst)
708
endif
709
710
user ?= $(or $(USER),$(LOGNAME),$(USERNAME))
711
lynx = $(user)@lynx.edgewall.com:/home/$(user)/dist
712
SCP ?= scp
713
714
release-src: wheel sdist
715
716
wheel:
717
	@$(PYTHON) setup.py bdist_wheel
718
sdist:
8995 by rjollos
1.3.2dev: Merge r16015 from 1.2-stable
719
	@$(PYTHON) setup.py sdist
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
720
8995 by rjollos
1.3.2dev: Merge r16015 from 1.2-stable
721
sdist+wheel = $(sdist_gztar) $(bdist_wheel)
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
722
723
sdist_gztar = dist/Trac-$(version).tar.gz
724
bdist_wheel = dist/Trac-$(version)-py2-none-any.whl
725
726
727
ifeq "$(OS)" "Windows_NT"
728
release-exe:
729
ifdef python.x86
730
	make python=x86 wininst
731
else
732
	$(error "define python.x86 in Makefile.cfg for building $(wininst.x86)")
733
endif
734
ifdef python.x64
735
	make python=x64 wininst
736
else
737
	$(error "define python.x64 in Makefile.cfg for building $(wininst.x64)")
738
endif
739
740
wininst = $(wininst.x86) $(wininst.x64)
741
742
wininst.x86 = dist/Trac-$(version).win32.exe
743
wininst.x64 = dist/Trac-$(version).win-amd64.exe
744
745
wininst:
746
	@$(PYTHON) setup.py bdist_wininst
747
endif # Windows_NT
748
749
packages = $(wildcard $(sdist+wheel) $(wininst))
750
751
checksum:
752
ifeq "$(version)" ""
753
	$(error "specify version= on the make command-line")
754
else
755
	@echo "Packages for Trac-$(version):"
756
	@echo
757
	@$(if $(packages), \
9403 by rjollos
1.3.4dev: Merge r16800 from 1.2-stable
758
	    $(PYTHON) contrib/checksum.py md5:sha256 $(packages) \
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
759
	, \
760
	    echo "No packages found: $(sdist+wheel) $(wininst)" \
761
	)
762
endif
763
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
764
copyright_re := "s/^($$PREFIX)(Copyright \(C\) 20[0-9][0-9])(-20[0-9][0-9])?$\
9649 by rjollos
1.5.1dev: Merge r17309 from 1.4-stable
765
    ( Edgewall Software\r?)$$/\1\2-$(year)\4/g"
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
766
767
update-copyright:
768
ifeq "$(year)" ""
769
	$(error "specify year= on the make command-line")
770
else
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
771
	$(eval SED = $(if \
772
	    $(shell sed --version 2>/dev/null | grep -qF "(GNU sed)" \
773
	      && echo 1), \
774
	    sed --in-place= -r -e, \
775
	    sed -i '' -E))
9644 by rjollos
1.5.1dev: Merge r17292 from 1.4-stable
776
	@PREFIX="\{\#\s+"; find . -type f -name "*.html" \
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
777
	    -exec $(SED) $(copyright_re) {} \;
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
778
	@PREFIX="\# "; find . -type f \
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
779
	    \( -name "*.py" -o -name "*.po" -o -name "*.pot" -o \
780
	       -name "*.ps1" -o -name "*.cgi" -o -name "*.fcgi" \) \
781
	    -exec $(SED) $(copyright_re) {} \;
782
	@PREFIX="\# "; $(SED) $(copyright_re) \
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
783
	    contrib/trac-svn-hook contrib/trac-pre-commit-hook
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
784
	@PREFIX=":: "; $(SED) $(copyright_re) \
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
785
	    contrib/trac-svn-post-commit-hook.cmd
9457 by jomae
1.3.4dev: merge [16890] from 1.2-stable (#9567)
786
	@PREFIX=; $(SED) $(copyright_re) COPYING
787
	@$(SED) "s/( year *= *)'(20[0-9][0-9])-20[0-9][0-9]'/\1'\2-$(year)'/" \
788
	    trac/admin/console.py trac/templates/about.html
9408 by rjollos
1.3.4dev: Merge r16810 from 1.2-stable
789
endif
790
9399 by rjollos
1.3.4dev: Merge r16797 from 1.2-stable
791
update-help:
9403 by rjollos
1.3.4dev: Merge r16800 from 1.2-stable
792
	@$(PYTHON) contrib/checkwiki.py -d --prefix=$(prefix)
793
	@$(PYTHON) contrib/wiki2rst.py TracUpgrade > UPGRADE.rst
794
	@$(PYTHON) contrib/wiki2rst.py TracInstall > INSTALL.rst
9399 by rjollos
1.3.4dev: Merge r16797 from 1.2-stable
795
8550 by cboos
1.3.2dev: merge [15281] from 1.2-stable (Makefile enhancements)
796
upload: checksum
797
ifeq "$(user)" ""
798
	$(error "define user in Makefile.cfg for uploading to lynx")
799
else
800
	$(if $(packages),$(SCP) $(packages) $(lynx))
801
endif # user
802
803
804

5981 by cboos
Resume work on generating the API documentation (#8695).
805
# ============================================================================
5486 by cboos
Makefile: reworked `coverage` target.
806
#
807
# Setup environment variables
808
8193 by cboos
1.2dev: support `pythonopts` make variable for passing parameters to Python.
809
PYTHON ?= python
810
PYTHON := $(PYTHON) $(pythonopts)
811
7367 by cboos
1.1.3dev: merged r13251 from 1.0-stable (`make status` improvements)
812
python-home := $(python.$(or $(python),$($(db).python)))
5486 by cboos
Makefile: reworked `coverage` target.
813
8275 by cboos
1.2dev: Merge [14760] from 1.0-stable (#12476)
814
ifeq "$(findstring ;,$(PATH))" ";"
815
    SEP = ;
816
    START ?= start
817
else
818
    SEP = :
819
    START ?= xdg-open
820
endif
821
5430 by cboos
Makefile: improve the help and add l10n related targets.
822
ifeq "$(OS)" "Windows_NT"
5491 by cboos
Makefile: fix the PATH, on Windows.
823
    ifndef python-home
6465 by cboos
Makefile: add `apidoc-check` rule + whitespace cleanup
824
        # Detect location of current python
7919 by rjollos
1.1.6dev: Replace `print` statement with `print` function. Refs #12047.
825
        python-exe := $(shell python -c 'import sys; print(sys.executable)')
5491 by cboos
Makefile: fix the PATH, on Windows.
826
        python-home := $(subst \python.exe,,$(python-exe))
8275 by cboos
1.2dev: Merge [14760] from 1.0-stable (#12476)
827
        ifeq "$(SEP)" ":"
828
            python-home := /$(subst :,,$(subst \,/,$(python-home)))
829
        endif
5491 by cboos
Makefile: fix the PATH, on Windows.
830
    endif
831
    python-bin = $(python-home)$(SEP)$(python-home)/Scripts
5430 by cboos
Makefile: improve the help and add l10n related targets.
832
endif
833
8275 by cboos
1.2dev: Merge [14760] from 1.0-stable (#12476)
834
define prepend-path
835
$(if $2,$(if $1,$1$(SEP)$2,$2),$1)
836
endef
837
838
PATH-extension = $(call prepend-path,$(python-bin),$(path.$(python)))
839
PYTHONPATH-extension = $(call prepend-path,.,$(pythonpath.$(python)))
840
841
export PATH := $(call prepend-path,$(PATH-extension),$(PATH))
842
export PYTHONPATH := $(call prepend-path,$(PYTHONPATH-extension),$(PYTHONPATH))
5430 by cboos
Makefile: improve the help and add l10n related targets.
843
export TRAC_TEST_DB_URI = $($(db).uri)
5820 by cboos
Makefile: fix `show-coverage` target, as coverage 3.3.1 on Linux tries to look into templates.
844
845
# Misc.
846
space = $(empty) $(empty)
847
comma = ,
5430 by cboos
Makefile: improve the help and add l10n related targets.
848
# ----------------------------------------------------------------------------