4
./bzr selftest $(tests)
5
@echo "Running all tests with no locale."
6
LC_CTYPE= LANG=C LC_ALL= ./bzr selftest $(tests)
9
./bzr --no-plugins selftest -v msgeditor
13
-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
19
# build emacs cross-reference
20
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
22
ctags-exuberant -e $(tag_files)
24
tutorial.html: tutorial.txt
25
rest2html tutorial.txt > tutorial.html
1
# Copyright (C) 2005-2012, 2016, 2017 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
# A relatively simple Makefile to assist in building parts of brz. Mostly for
18
# building documentation, etc.
30
PLUGIN_TARGET=plugin-release
32
BRZ_PLUGIN_PATH=-site:-user
34
# Shorter replacement for $(sort $(wildcard <arg>)) as $(call sw,<arg>)
35
sw = $(sort $(wildcard $(1)))
38
.PHONY: all clean realclean extensions flake8 api-docs check-nodocs check
43
@echo "building extension modules."
44
$(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
46
check: docs check-nodocs
48
check-nodocs: check-nodocs2 check-nodocs3
51
# Generate a stream for PQM to watch.
52
-$(RM) -f selftest.log
53
echo `date` ": selftest starts" 1>&2
54
set -o pipefail; BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON3) -Werror -Wignore::ImportWarning -Wignore::PendingDeprecationWarning -Wignore::DeprecationWarning -O \
55
./brz selftest -Oselftest.timeout=120 --strict \
56
--subunit2 $(tests) | tee selftest.log | subunit-2to1
57
echo `date` ": selftest ends" 1>&2
58
# An empty log file should catch errors in the $(PYTHON3)
59
# command above (the '|' swallow any errors since 'make'
60
# sees the 'tee' exit code for the whole line
61
if [ ! -s selftest.log ] ; then exit 1 ; fi
62
# Check that there were no errors reported.
63
subunit-stats < selftest.log
65
check-nodocs2: extensions
66
# Generate a stream for PQM to watch.
67
-$(RM) -f selftest.log
68
echo `date` ": selftest starts" 1>&2
69
set -o pipefail; BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON) -Werror -Wignore::ImportWarning -Wignore::DeprecationWarning -O \
70
./brz selftest -Oselftest.timeout=120 \
71
--subunit2 $(tests) | tee selftest.log | subunit-2to1
72
echo `date` ": selftest ends" 1>&2
73
# An empty log file should catch errors in the $(PYTHON)
74
# command above (the '|' swallow any errors since 'make'
75
# sees the 'tee' exit code for the whole line
76
if [ ! -s selftest.log ] ; then exit 1 ; fi
77
# Check that there were no errors reported.
78
subunit-stats < selftest.log
80
check-ci: docs extensions
81
# FIXME: Remove -Wignore::FutureWarning once
82
# https://github.com/paramiko/paramiko/issues/713 is not a concern
83
# anymore -- vila 2017-05-24
85
BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON) -Werror -Wignore::FutureWarning -Wignore::DeprecationWarning -Wignore::ImportWarning -Wignore::ResourceWarning -O \
86
./brz selftest -v --parallel=fork -Oselftest.timeout=120 --subunit2 \
87
| subunit-filter -s --passthrough --rename "^" "python2."; \
88
BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON3) -Werror -Wignore::FutureWarning -Wignore::DeprecationWarning -Wignore::PendingDeprecationWarning -Wignore::ImportWarning -Wignore::ResourceWarning -O \
89
./brz selftest -v --parallel=fork -Oselftest.timeout=120 --subunit2 \
90
| subunit-filter -s --passthrough --rename "^" "python3."
92
# Run Python style checker (apt-get install flake8)
94
# Note that at present this gives many false warnings, because it doesn't
95
# know about identifiers loaded through lazy_import.
100
$(PYTHON) setup.py clean
101
-find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
104
# Remove files which are autogenerated but included by the tarball.
105
rm -f breezy/*_pyx.c breezy/bzr/*_pyx.c
106
rm -f breezy/_simple_set_pyx.h breezy/_simple_set_pyx_api.h
108
# build tags for emacs and vim
115
# these are treated as phony so they'll always be rebuilt - it's pretty quick
119
### Documentation ###
123
clean-docs: clean-sphinx
125
html-docs: html-sphinx
128
### Man-page Documentation ###
130
MAN_DEPENDENCIES = breezy/builtins.py \
131
$(call sw,breezy/*.py) \
132
$(call sw,breezy/*/*.py) \
133
tools/generate_docs.py \
134
$(call sw,$(addsuffix /*.txt, breezy/help_topics/en))
136
MAN_PAGES = man1/brz.1
137
man1/brz.1: $(MAN_DEPENDENCIES)
139
$(PYTHON) tools/generate_docs.py -o $@ man
142
### Sphinx-style Documentation ###
144
# Build the documentation. To keep the dependencies down to a minimum
145
# for distro packagers, we only build the html documentation by default.
146
# Sphinx 0.6 or later is preferred for the best rendering, though
147
# Sphinx 0.4 or later should work. See http://sphinx.pocoo.org/index.html
148
# for installation instructions.
149
docs-sphinx: html-sphinx
151
# Clean out generated documentation
153
$(MAKE) -C doc/en clean
154
$(MAKE) -C doc/developers clean
156
SPHINX_DEPENDENCIES = \
157
doc/en/release-notes/index.txt \
158
doc/en/user-reference/index.txt \
159
doc/developers/Makefile \
160
doc/developers/make.bat
162
NEWS_FILES = $(call sw,doc/en/release-notes/brz-*.txt)
164
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
165
LANGUAGE=C $(PYTHON) tools/generate_docs.py -o $@ rstx
167
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
168
$(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
170
doc/%/Makefile: doc/en/Makefile
171
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
173
doc/%/make.bat: doc/en/make.bat
174
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
176
# Build the html docs using Sphinx.
177
html-sphinx: $(SPHINX_DEPENDENCIES)
178
$(MAKE) -C doc/en html
179
$(MAKE) -C doc/developers api html
181
# Build the PDF docs using Sphinx. This requires numerous LaTeX
182
# packages. See http://sphinx.pocoo.org/builders.html for details.
183
# Note: We don't currently build PDFs for the Russian docs because
184
# they require additional packages to be installed (to handle
185
# Russian hyphenation rules, etc.)
186
pdf-sphinx: $(SPHINX_DEPENDENCIES)
187
$(MAKE) -C doc/en latex
188
$(MAKE) -C doc/developers latex
189
$(MAKE) -C doc/en/_build/latex all-pdf
190
$(MAKE) -C doc/developers/_build/latex all-pdf
192
# Build the CHM (Windows Help) docs using Sphinx.
193
# Note: HtmlHelp Workshop needs to be used on the generated hhp files
194
# to generate the final chm files.
195
chm-sphinx: $(SPHINX_DEPENDENCIES)
196
$(MAKE) -C doc/en htmlhelp
197
$(MAKE) -C doc/developers htmlhelp
200
# Build the texinfo files using Sphinx.
201
texinfo-sphinx: $(SPHINX_DEPENDENCIES)
202
$(MAKE) -C doc/en texinfo
203
$(MAKE) -C doc/developers texinfo
205
### Documentation Website ###
207
# Where to build the website
208
DOC_WEBSITE_BUILD = build_doc_website
210
# Build and package docs into a website, complete with downloads.
211
doc-website: html-sphinx pdf-sphinx
212
$(PYTHON) tools/package_docs.py doc/en $(DOC_WEBSITE_BUILD)
213
$(PYTHON) tools/package_docs.py doc/developers $(DOC_WEBSITE_BUILD)
216
### Miscellaneous Documentation Targets ###
218
# build a png of our performance task list
219
# this is no longer built by default; you can build it if you want to look at it
220
doc/developers/performance.png: doc/developers/performance.dot
222
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
225
### Windows Support ###
227
# make all the installers completely from scratch, using zc.buildout
228
# to fetch the dependencies
229
# These are files that need to be copied into the build location to boostrap
231
# Note that the path is relative to tools/win32
232
BUILDOUT_FILES = buildout.cfg \
233
buildout-templates/bin/build-installer.bat.in \
234
ostools.py bootstrap.py
237
@echo Make all the installers from scratch
238
@# Build everything in a separate directory, to avoid cluttering the WT
239
$(PYTHON) tools/win32/ostools.py makedir build-win32
240
@# cd to tools/win32 so that the relative paths are copied correctly
241
cd tools/win32 && $(PYTHON) ostools.py copytree $(BUILDOUT_FILES) ../../build-win32
242
@# There seems to be a bug in gf.release.brz, It doesn't correctly update
243
@# existing release directories, so delete them manually before building
244
@# It means things may be rebuilt that don't need to be, but at least
245
@# it will be correct when they do.
246
cd build-win32 && $(PYTHON) ostools.py remove release */release
247
cd build-win32 && $(PYTHON) bootstrap.py
248
cd build-win32 && bin/buildout
249
cd build-win32 && bin/build-installer.bat $(BRZ_TARGET) $(PLUGIN_TARGET)
253
$(PYTHON) tools/win32/ostools.py remove build-win32
255
# make brz.exe for win32 with py2exe
257
@echo *** Make brz.exe
258
$(PYTHON) tools/win32/ostools.py remove breezy/*.pyd
259
$(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
260
$(PYTHON) setup.py py2exe > py2exe.log
261
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_brz.bat win32_brz.exe
262
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_brz.exe
264
# win32 installer for brz.exe
265
installer: exe copy-docs
266
@echo *** Make Windows installer
267
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/brz.iss tools/win32/brz.iss.cog
268
iscc /Q tools/win32/brz.iss
270
# win32 Python's distutils-based installer
271
# require to have Python interpreter installed on win32
273
$(PYTHON24) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
276
$(PYTHON25) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
279
$(PYTHON26) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
281
python-installer: py-inst-24 py-inst-25 py-inst-26
285
$(PYTHON) tools/win32/ostools.py copytodir README win32_brz.exe/doc
286
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_brz.exe
288
# clean on win32 all installer-related files and directories
289
clean-win32: clean-docs
290
$(PYTHON) tools/win32/ostools.py remove build
291
$(PYTHON) tools/win32/ostools.py remove win32_brz.exe
292
$(PYTHON) tools/win32/ostools.py remove py2exe.log
293
$(PYTHON) tools/win32/ostools.py remove tools/win32/brz.iss
294
$(PYTHON) tools/win32/ostools.py remove brz-setup*.exe
295
$(PYTHON) tools/win32/ostools.py remove brz-*win32.exe
296
$(PYTHON) tools/win32/ostools.py remove dist
301
.PHONY: update-pot po/brz.pot
302
update-pot: po/brz.pot
304
TRANSLATABLE_PYFILES:=$(shell find breezy -name '*.py' \
305
| grep -v 'breezy/tests/' \
306
| grep -v 'breezy/doc' \
309
po/brz.pot: $(PYFILES) $(DOCFILES)
310
$(PYTHON) ./brz export-pot --include-duplicates > po/brz.pot
311
echo $(TRANSLATABLE_PYFILES) | xargs \
312
xgettext --package-name "brz" \
313
--msgid-bugs-address "<bazaar@canonical.com>" \
314
--copyright-holder "Canonical" \
315
--from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
316
-d bzr -p po -o brz.pot
319
### Packaging Targets ###
321
.PHONY: dist check-dist-tarball
323
# build a distribution source tarball
325
version=`./brz version --short` && \
326
echo Building distribution of brz $$version && \
327
expbasedir=`mktemp -t -d tmp_brz_dist.XXXXXXXXXX` && \
328
expdir=$$expbasedir/brz-$$version && \
329
tarball=$$PWD/../breezy-$$version.tar.gz && \
332
$(PYTHON) setup.py sdist -d $$PWD/.. && \
333
gpg --detach-sign --armor $$tarball && \
336
# run all tests in a previously built tarball
338
tmpdir=`mktemp -t -d tmp_brz_check_dist.XXXXXXXXXX` && \
339
version=`./brz version --short` && \
340
tarball=$$PWD/../breezy-$$version.tar.gz && \
341
tar Cxz $$tmpdir -f $$tarball && \
342
$(MAKE) -C $$tmpdir/breezy-$$version check && \