Repository: trafficserver
Updated Branches:
  refs/heads/master 1a11bd836 -> 02244d06e


docs: Make the version info identical when building with Autotools (e.g. $ make 
html) and without (e.g. on Read the Docs)


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/02244d06
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/02244d06
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/02244d06

Branch: refs/heads/master
Commit: 02244d06e83139f69488fcbecf247fe6938563e5
Parents: 1a11bd8
Author: Jack Bates <[email protected]>
Authored: Sat Aug 30 14:20:06 2014 -0700
Committer: Jack Bates <[email protected]>
Committed: Sat Aug 30 14:20:06 2014 -0700

----------------------------------------------------------------------
 doc/Makefile.am |  2 --
 doc/conf.py     | 22 +++++++++++++---------
 2 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02244d06/doc/Makefile.am
----------------------------------------------------------------------
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 966d601..03e3e05 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -93,8 +93,6 @@ I18NSPHINXOPTS  = $(SPHINXOPTS)
 # detects as non-portable. We bounce this through a shell script and do the 
expansion there.
 SBUILD = PAPEROPT_a4="$(PAPEROPT_a4)" PAPEROPT_letter="$(PAPEROPT_letter)" 
PAPER="$(PAPER)" \
         $(srcdir)/sbuild $(SPHINXBUILD) \
-        -D version=$(TS_VERSION_STRING) \
-        -D release=$(TS_VERSION_STRING) \
         -c $(srcdir) \
         $(ALLSPHINXOPTS)
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/02244d06/doc/conf.py
----------------------------------------------------------------------
diff --git a/doc/conf.py b/doc/conf.py
index b3e43ce..5317273 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -76,15 +76,20 @@ copyright = u'2014, [email protected]'
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
-#
-# NOTE: The build system automatically sets the version correctly, but external
-# sphinx builders (like readthedocs.org) do not, so we still have to manually
-# update a reasonable version number here.
-#
-# The short X.Y version.
-version = '5.2'
+
+# Extract the version from the configure.ac file with regex so as to
+# work identically when building with Autotools (e.g. $ make html)
+# and without (e.g. on Read the Docs)
+
+import re
+
+contents = open('../configure.ac').read()
+match = re.compile('m4_define\(\[TS_VERSION_S],\[(.*?)]\)').search(contents)
+
 # The full version, including alpha/beta/rc tags.
-release = '5.2.x'
+release = match.group(1)
+# The short X.Y version.
+version = '.'.join(release.split('.', 2)[:2])
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -143,7 +148,6 @@ nitpicky=1
 
 # Autolink issue references
 
-import re
 from docutils import nodes
 from docutils.parsers.rst import states
 from docutils.utils import unescape

Reply via email to