/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Jelmer Vernooij
  • Date: 2018-12-10 01:46:35 UTC
  • mto: This revision was merged to the branch mainline in revision 7219.
  • Revision ID: jelmer@jelmer.uk-20181210014635-oxhnf8s46u0nvp5c
Fix import

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
all: 
2
 
 
3
 
check:
4
 
        ./bzr selftest $(tests)
5
 
        @echo "Running all tests with no locale."
6
 
        LC_CTYPE= LANG=C LC_ALL= ./bzr selftest $(tests)
7
 
 
8
 
check-msgeditor:
9
 
        ./bzr --no-plugins selftest -v msgeditor
10
 
 
11
 
clean: 
12
 
        ./setup.py clean
13
 
        -find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
14
 
        rm -rf test????.tmp
15
 
 
16
 
.PHONY: all
17
 
 
18
 
 
19
 
# build emacs cross-reference
20
 
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
21
 
TAGS: $(tag_files)
22
 
        ctags-exuberant -e $(tag_files)
23
 
 
24
 
tutorial.html: tutorial.txt
25
 
        rest2html tutorial.txt > tutorial.html
 
1
# Copyright (C) 2005-2012, 2016, 2017 Canonical Ltd
 
2
#
 
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.
 
7
#
 
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.
 
12
#
 
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
 
16
 
 
17
# A relatively simple Makefile to assist in building parts of brz. Mostly for
 
18
# building documentation, etc.
 
19
 
 
20
 
 
21
### Core Stuff ###
 
22
 
 
23
SHELL=bash
 
24
PYTHON?=python
 
25
PYTHON3?=python3
 
26
PYTHON24=python24
 
27
PYTHON25=python25
 
28
PYTHON26=python26
 
29
BRZ_TARGET=release
 
30
PLUGIN_TARGET=plugin-release
 
31
PYTHON_BUILDFLAGS=
 
32
BRZ_PLUGIN_PATH=-site:-user
 
33
 
 
34
# Shorter replacement for $(sort $(wildcard <arg>)) as $(call sw,<arg>)
 
35
sw = $(sort $(wildcard $(1)))
 
36
 
 
37
 
 
38
.PHONY: all clean realclean extensions flake8 api-docs check-nodocs check
 
39
 
 
40
all: extensions
 
41
 
 
42
extensions:
 
43
        @echo "building extension modules."
 
44
        $(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
 
45
 
 
46
check: docs check-nodocs
 
47
 
 
48
check-nodocs: check-nodocs2 check-nodocs3
 
49
 
 
50
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
 
64
 
 
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
 
79
 
 
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
 
84
        set -o pipefail; \
 
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."
 
91
 
 
92
# Run Python style checker (apt-get install flake8)
 
93
#
 
94
# Note that at present this gives many false warnings, because it doesn't
 
95
# know about identifiers loaded through lazy_import.
 
96
flake8:
 
97
        flake8
 
98
 
 
99
clean:
 
100
        $(PYTHON) setup.py clean
 
101
        -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
 
102
 
 
103
realclean: clean
 
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
 
107
 
 
108
# build tags for emacs and vim
 
109
TAGS:
 
110
        ctags -R -e breezy
 
111
 
 
112
tags:
 
113
        ctags -R breezy
 
114
 
 
115
# these are treated as phony so they'll always be rebuilt - it's pretty quick
 
116
.PHONY: TAGS tags
 
117
 
 
118
 
 
119
### Documentation ###
 
120
 
 
121
docs: docs-sphinx
 
122
 
 
123
clean-docs: clean-sphinx
 
124
 
 
125
html-docs: html-sphinx
 
126
 
 
127
 
 
128
### Man-page Documentation ###
 
129
 
 
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)) 
 
135
 
 
136
MAN_PAGES = man1/brz.1
 
137
man1/brz.1: $(MAN_DEPENDENCIES)
 
138
        mkdir -p $(dir $@)
 
139
        $(PYTHON) tools/generate_docs.py -o $@ man
 
140
 
 
141
 
 
142
### Sphinx-style Documentation ###
 
143
 
 
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
 
150
 
 
151
# Clean out generated documentation
 
152
clean-sphinx:
 
153
        $(MAKE) -C doc/en clean
 
154
        $(MAKE) -C doc/developers clean
 
155
 
 
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
 
161
 
 
162
NEWS_FILES = $(call sw,doc/en/release-notes/brz-*.txt)
 
163
 
 
164
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
 
165
        LANGUAGE=C $(PYTHON) tools/generate_docs.py -o $@ rstx
 
166
 
 
167
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
 
168
        $(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
 
169
 
 
170
doc/%/Makefile: doc/en/Makefile
 
171
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
 
172
 
 
173
doc/%/make.bat: doc/en/make.bat
 
174
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
 
175
 
 
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
 
180
 
 
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
 
191
 
 
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
 
198
 
 
199
 
 
200
# Build the texinfo files using Sphinx.
 
201
texinfo-sphinx: $(SPHINX_DEPENDENCIES)
 
202
        $(MAKE) -C doc/en texinfo
 
203
        $(MAKE) -C doc/developers texinfo
 
204
 
 
205
### Documentation Website ###
 
206
 
 
207
# Where to build the website
 
208
DOC_WEBSITE_BUILD = build_doc_website
 
209
 
 
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)
 
214
 
 
215
 
 
216
### Miscellaneous Documentation Targets ###
 
217
 
 
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
 
221
        @echo Generating $@
 
222
        @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
 
223
 
 
224
 
 
225
### Windows Support ###
 
226
 
 
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
 
230
# the build process.
 
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
 
235
 
 
236
installer-all:
 
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)
 
250
 
 
251
 
 
252
clean-installer-all:
 
253
        $(PYTHON) tools/win32/ostools.py remove build-win32
 
254
 
 
255
# make brz.exe for win32 with py2exe
 
256
exe:
 
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
 
263
 
 
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
 
269
 
 
270
# win32 Python's distutils-based installer
 
271
# require to have Python interpreter installed on win32
 
272
py-inst-24: docs
 
273
        $(PYTHON24) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
 
274
 
 
275
py-inst-25: docs
 
276
        $(PYTHON25) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
 
277
 
 
278
py-inst-26: docs
 
279
        $(PYTHON26) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
 
280
 
 
281
python-installer: py-inst-24 py-inst-25 py-inst-26
 
282
 
 
283
 
 
284
copy-docs: docs
 
285
        $(PYTHON) tools/win32/ostools.py copytodir README win32_brz.exe/doc
 
286
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_brz.exe
 
287
 
 
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
 
297
 
 
298
 
 
299
# i18n targets
 
300
 
 
301
.PHONY: update-pot po/brz.pot
 
302
update-pot: po/brz.pot
 
303
 
 
304
TRANSLATABLE_PYFILES:=$(shell find breezy -name '*.py' \
 
305
                | grep -v 'breezy/tests/' \
 
306
                | grep -v 'breezy/doc' \
 
307
                )
 
308
 
 
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
 
317
 
 
318
 
 
319
### Packaging Targets ###
 
320
 
 
321
.PHONY: dist check-dist-tarball
 
322
 
 
323
# build a distribution source tarball
 
324
dist: 
 
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 && \
 
330
        $(MAKE) clean && \
 
331
        $(MAKE) && \
 
332
        $(PYTHON) setup.py sdist -d $$PWD/.. && \
 
333
        gpg --detach-sign --armor $$tarball && \
 
334
        rm -rf $$expbasedir
 
335
 
 
336
# run all tests in a previously built tarball
 
337
check-dist-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 && \
 
343
        rm -rf $$tmpdir