44
49
pyflakes bzrlib | grep -v ' imported but unused'
48
-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
52
$(PYTHON) setup.py clean
53
-find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
55
# Build API documentation
51
56
docfiles = bzr bzrlib
54
PYTHONPATH=$(PWD) python tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
59
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
57
PYTHONPATH=$(PWD) python tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
60
# build emacs cross-reference
61
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
63
ctags-exuberant -e $(tag_files)
66
# Produce HTML docs to upload on Canonical server
68
PRETTYDIR := pretty_docs
71
python tools/win32/ostools.py copytodir $(htm_files) doc/default.css $(HTMLDIR)
61
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
63
# build tags for emacs and vim
70
# these are treated as phony so they'll always be rebuilt - it's pretty quick
75
# set PRETTY to get docs that look like the Bazaar web site
77
rst2html := $(PYTHON) tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid
79
rst2html := $(PYTHON) tools/rst2html.py --link-stylesheet --footnote-references=superscript --halt=warning
74
82
# translate txt docs to html
76
txt_files := $(wildcard $(addsuffix /*.txt, $(doc_dir))) doc/bzr_man.txt
77
htm_files := $(patsubst %.txt, %.htm, $(txt_files))
83
derived_txt_files := \
84
doc/en/user-reference/bzr_man.txt \
85
doc/en/developer-guide/HACKING.txt \
86
doc/en/release-notes/NEWS.txt
87
txt_files := $(wildcard doc/en/tutorials/*.txt) \
88
$(derived_txt_files) \
89
doc/en/user-guide/index.txt \
90
doc/en/mini-tutorial/index.txt \
91
$(wildcard doc/es/guia-usario/*.txt) \
92
doc/es/mini-tutorial/index.txt \
97
doc/en/quick-reference/quick-start-summary.svg \
98
doc/en/quick-reference/quick-start-summary.png \
99
doc/en/quick-reference/quick-start-summary.pdf \
100
$(wildcard doc/en/user-guide/images/*.png) \
101
doc/es/referencia-rapida/referencia-rapida.svg \
102
doc/es/referencia-rapida/referencia-rapida.png \
103
doc/es/referencia-rapida/referencia-rapida.pdf \
104
$(wildcard doc/es/guia-usuario/images/*.png)
105
htm_files := $(patsubst %.txt, %.html, $(txt_files))
78
106
dev_txt_files := $(wildcard $(addsuffix /*.txt, doc/developers))
79
dev_htm_files := $(patsubst %.txt, %.htm, $(dev_txt_files))
81
pretty-html-docs: pretty_files
84
python -c "import os; os.mkdir('$(PRETTYDIR)')"
86
pretty_files: $(patsubst doc/%.txt, $(PRETTYDIR)/%.htm, $(txt_files))
88
doc/developers/%.htm: doc/developers/%.txt
89
python tools/rst2html.py --link-stylesheet --stylesheet=../default.css --footnote-references=superscript $< $@
91
doc/developers/HACKING.htm: doc/developers/HACKING
92
python tools/rst2html.py --link-stylesheet --stylesheet=../default.css --footnote-references=superscript $< $@
95
python tools/rst2html.py --link-stylesheet --stylesheet=default.css --footnote-references=superscript $< $@
97
$(PRETTYDIR)/%.htm: pretty_docs doc/%.txt
98
python tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid doc/$*.txt \
107
dev_htm_files := $(patsubst %.txt, %.html, $(dev_txt_files))
109
doc/en/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/en/user-guide))
110
$(rst2html) --stylesheet=../../default.css doc/en/user-guide/index.txt $@
112
doc/developers/%.html: doc/developers/%.txt
113
$(rst2html) --stylesheet=../default.css $< $@
115
doc/index.html: doc/index.txt
116
$(rst2html) --stylesheet=default.css $< $@
119
$(rst2html) --stylesheet=../../default.css $< $@
101
121
MAN_DEPENDENCIES = bzrlib/builtins.py \
102
122
bzrlib/bundle/commands.py \
103
123
bzrlib/conflicts.py \
124
bzrlib/help_topics/__init__.py \
104
125
bzrlib/sign_my_commits.py \
126
bzrlib/bugtracker.py \
105
127
generate_docs.py \
106
128
tools/doc_generate/__init__.py \
107
tools/doc_generate/autodoc_rstx.py
109
doc/bzr_man.txt: $(MAN_DEPENDENCIES)
110
python generate_docs.py -o $@ rstx
129
tools/doc_generate/autodoc_man.py \
130
tools/doc_generate/autodoc_rstx.py \
131
$(wildcard $(addsuffix /*.txt, bzrlib/help_topics/en))
133
doc/en/user-reference/bzr_man.txt: $(MAN_DEPENDENCIES)
134
$(PYTHON) generate_docs.py -o $@ rstx
136
doc/en/developer-guide/HACKING.txt: doc/developers/HACKING.txt
137
$(PYTHON) tools/win32/ostools.py copytodir doc/developers/HACKING.txt doc/en/developer-guide
139
doc/en/release-notes/NEWS.txt: NEWS
140
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
112
142
MAN_PAGES = man1/bzr.1
113
143
man1/bzr.1: $(MAN_DEPENDENCIES)
114
python generate_docs.py -o $@ man
116
ALL_DOCS = $(htm_files) $(MAN_PAGES) doc/developers/HACKING.htm $(dev_htm_files)
144
$(PYTHON) generate_docs.py -o $@ man
146
# build a png of our performance task list
147
doc/developers/performance.png: doc/developers/performance.dot
149
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
151
derived_web_docs = $(htm_files) $(dev_htm_files) doc/developers/performance.png
152
WEB_DOCS = $(derived_web_docs) $(non_txt_files)
153
ALL_DOCS = $(derived_web_docs) $(MAN_PAGES)
155
# the main target to build all the docs
117
156
docs: $(ALL_DOCS)
120
python tools/win32/ostools.py copytodir $(htm_files) \
121
doc/default.css NEWS README \
123
python tools/win32/ostools.py copytodir doc/developers/HACKING.htm \
125
win32_bzr.exe/doc/developers
158
# produce a tree containing just the final docs, ready for uploading to the web
161
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
127
163
# clean produced docs
129
python tools/win32/ostools.py remove $(ALL_DOCS) \
130
$(HTMLDIR) $(PRETTYDIR) doc/bzr_man.txt
165
$(PYTHON) tools/win32/ostools.py remove $(ALL_DOCS) \
166
$(HTMLDIR) $(derived_txt_files)
169
### Windows Support ###
133
171
# make bzr.exe for win32 with py2exe
135
173
@echo *** Make bzr.exe
136
python setup.py py2exe > py2exe.log
137
python tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
138
python tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
174
$(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
175
$(PYTHON) setup.py py2exe > py2exe.log
176
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
177
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
140
179
# win32 installer for bzr.exe
141
180
installer: exe copy-docs
142
181
@echo *** Make windows installer
143
cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
182
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
144
183
iscc /Q tools/win32/bzr.iss
146
# win32 python's distutils-based installer
147
# require to have python interpreter installed on win32
148
python-installer: docs
149
python setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
185
# win32 Python's distutils-based installer
186
# require to have Python interpreter installed on win32
188
python24 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
191
python25 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
193
python-installer: py-inst-24 py-inst-25
197
$(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
198
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
152
200
# clean on win32 all installer-related files and directories
154
python tools/win32/ostools.py remove build
155
python tools/win32/ostools.py remove win32_bzr.exe
156
python tools/win32/ostools.py remove py2exe.log
157
python tools/win32/ostools.py remove doc/*.htm
158
python tools/win32/ostools.py remove doc/developers/*.htm
159
python tools/win32/ostools.py remove doc/bzr_man.txt
160
python tools/win32/ostools.py remove tools/win32/bzr.iss
161
python tools/win32/ostools.py remove bzr-setup*.exe
162
python tools/win32/ostools.py remove bzr-*win32.exe
163
python tools/win32/ostools.py remove dist
201
clean-win32: clean-docs
202
$(PYTHON) tools/win32/ostools.py remove build
203
$(PYTHON) tools/win32/ostools.py remove win32_bzr.exe
204
$(PYTHON) tools/win32/ostools.py remove py2exe.log
205
$(PYTHON) tools/win32/ostools.py remove tools/win32/bzr.iss
206
$(PYTHON) tools/win32/ostools.py remove bzr-setup*.exe
207
$(PYTHON) tools/win32/ostools.py remove bzr-*win32.exe
208
$(PYTHON) tools/win32/ostools.py remove dist
210
.PHONY: dist dist-upload-escudero check-dist-tarball
212
# build a distribution tarball.
214
# this method of copying the pyrex generated files is a bit ugly; it would be
215
# nicer to generate it from distutils.
217
# these are a bit ubuntu-specific.
219
version=`./bzr version --short` && \
220
echo Building distribution of bzr $$version && \
221
expbasedir=`mktemp -t -d tmp_bzr_dist.XXXXXXXXXX` && \
222
expdir=$$expbasedir/bzr-$$version && \
223
tarball=$$PWD/../bzr-$$version.tar.gz && \
226
bzr export $$expdir && \
227
cp bzrlib/*.c $$expdir/bzrlib/. && \
228
tar cfz $$tarball -C $$expbasedir bzr-$$version && \
229
gpg --detach-sign $$tarball && \
230
echo $$tarball done. && \
233
# run all tests in a previously built tarball
235
tmpdir=`mktemp -t -d tmp_bzr_check_dist.XXXXXXXXXX` && \
236
version=`./bzr version --short` && \
237
tarball=$$PWD/../bzr-$$version.tar.gz && \
238
tar Cxz $$tmpdir -f $$tarball && \
239
$(MAKE) -C $$tmpdir/bzr-$$version check && \
243
# upload previously built tarball to the download directory on bazaar-vcs.org,
244
# and verify that it can be downloaded ok.
245
dist-upload-escudero:
246
version=`./bzr version --short` && \
247
tarball=../bzr-$$version.tar.gz && \
248
scp $$tarball $$tarball.sig \
249
escudero.ubuntu.com:/srv/bazaar.canonical.com/www/releases/src \
251
echo verifying over http... && \
252
curl http://bazaar-vcs.org/releases/src/bzr-$$version.tar.gz \
253
| diff -s - $$tarball && \
254
curl http://bazaar-vcs.org/releases/src/bzr-$$version.tar.gz.sig \
255
| diff -s - $$tarball.sig