Skip to content

Commit 1f9f35f

Browse files
committed
add build version in index.
1 parent 2d7d77a commit 1f9f35f

6 files changed

Lines changed: 42 additions & 22 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_version.inc

Makefile

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,38 @@ help:
3737
clean:
3838
-rm -rf $(BUILDDIR)/*
3939

40-
html: images
40+
html: pre-build
4141
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
4242
@echo
4343
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
4444

45-
dirhtml: images
45+
dirhtml: pre-build
4646
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
4747
@echo
4848
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
4949

50-
singlehtml: images
50+
singlehtml: pre-build
5151
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
5252
@echo
5353
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
5454

55-
pickle: images
55+
pickle: pre-build
5656
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
5757
@echo
5858
@echo "Build finished; now you can process the pickle files."
5959

60-
json: images
60+
json: pre-build
6161
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
6262
@echo
6363
@echo "Build finished; now you can process the JSON files."
6464

65-
htmlhelp: images
65+
htmlhelp: pre-build
6666
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
6767
@echo
6868
@echo "Build finished; now you can run HTML Help Workshop with the" \
6969
".hhp project file in $(BUILDDIR)/htmlhelp."
7070

71-
qthelp: images
71+
qthelp: pre-build
7272
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
7373
@echo
7474
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
@@ -77,7 +77,7 @@ qthelp: images
7777
@echo "To view the help file:"
7878
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/GotGitHub.qhc"
7979

80-
devhelp: images
80+
devhelp: pre-build
8181
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
8282
@echo
8383
@echo "Build finished."
@@ -86,46 +86,44 @@ devhelp: images
8686
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/GotGitHub"
8787
@echo "# devhelp"
8888

89-
epub: images
89+
epub: pre-build
9090
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
9191
@echo
9292
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
9393

94-
latex: images
94+
latex: pre-build
9595
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
9696
@echo
9797
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
9898
@echo "Run \`make' in that directory to run these through (pdf)latex" \
9999
"(use \`make latexpdf' here to do that automatically)."
100100

101-
latexpdf: images
101+
latexpdf: pre-build
102102
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
103103
@echo "Running LaTeX files through pdflatex..."
104104
make -C $(BUILDDIR)/latex all-pdf
105105
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
106106

107-
text: images
107+
text: pre-build
108108
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
109109
@echo
110110
@echo "Build finished. The text files are in $(BUILDDIR)/text."
111111

112-
man: images
112+
man: pre-build
113113
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
114114
@echo
115115
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
116116

117-
changes: images
117+
changes: pre-build
118118
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
119119
@echo
120120
@echo "The overview file is in $(BUILDDIR)/changes."
121121

122-
linkcheck: images
122+
linkcheck: pre-build
123123
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
124124
@echo
125125
@echo "Link check complete; look for any errors in the above output " \
126126
"or in $(BUILDDIR)/linkcheck/output.txt."
127-
images:
128-
(cd graphics; rake convert[../images,600] )
129127

130128
gh-pages: clean html
131129
@if ! git rev-parse refs/heads/gh-pages >/dev/null 2>&1 ; then \
@@ -153,4 +151,18 @@ doctest:
153151
@echo "Testing of doctests in the sources finished, look at the " \
154152
"results in $(BUILDDIR)/doctest/output.txt."
155153

156-
.PHONY : clean images gh-pages
154+
pre-build: images update-version
155+
156+
images:
157+
(cd graphics; rake convert[../images,600] )
158+
159+
update-version:
160+
@sed -e "s#<version>#$$(git describe --dirty --always)#g" < _version.inc.in > _version.inc.tmp
161+
@if diff -q _version.inc.tmp _version.inc >/dev/null 2>&1; then \
162+
rm _version.inc.tmp; \
163+
else \
164+
echo "_version.inc.in => _version.inc" ; \
165+
mv _version.inc.tmp _version.inc; \
166+
fi
167+
168+
.PHONY : clean pre-build images gh-pages

_version.inc.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
::
2+
3+
Author : Jiang Xin
4+
Version: <version>
5+
File renamed without changes.

index.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
GotGitHub
77
==========
88

9+
.. include:: _version.inc
10+
911
前言
1012
----
1113

12-
.. include:: preface.rst
14+
.. include:: preface.inc
1315

1416
目录
1517
----
@@ -27,9 +29,9 @@ GotGitHub
2729
06-side-projects/index
2830
20-appendix/index
2931

30-
贡献者
31-
------
32-
.. include:: contributors.rst
32+
贡献者列表
33+
----------
34+
.. include:: contributors.inc
3335

3436

3537
.. 索引和表格
File renamed without changes.

0 commit comments

Comments
 (0)