aboutsummaryrefslogtreecommitdiffstats
path: root/doc/conf.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/conf.py')
-rw-r--r--doc/conf.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/doc/conf.py b/doc/conf.py
index e9c53f9ad..650942af1 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -54,10 +54,23 @@ author = u'Tristan Gingold'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
-# The short X.Y version.
-version = '0.33'
-# The full version, including alpha/beta/rc tags.
-release = '0.33'
+def _IsUnderGitControl():
+ return (check_output(["git", "rev-parse", "--is-inside-work-tree"], universal_newlines=True).strip() == "true")
+
+def _LatestTagName():
+ return check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip()
+
+version = "0.33" # The short X.Y version.
+release = "0.33" # The full version, including alpha/beta/rc tags.
+try:
+ if _IsUnderGitControl:
+ latestTagName = _LatestTagName()[1:] # remove prefix "v"
+ versionParts = latestTagName.split("-")[0].split(".")
+
+ version = ".".join(versionParts[:2])
+ release = version # ".".join(versionParts[:3])
+except:
+ pass
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.