diff options
author | Patrick Lehmann <Patrick.Lehmann@tu-dresden.de> | 2016-12-10 21:40:10 +0100 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@tu-dresden.de> | 2016-12-10 21:42:21 +0100 |
commit | aec08861c8c24b546be9d95bde3fe3d50926bac0 (patch) | |
tree | 78b359de105514050697ce96945b5810f92bcf6b /doc/conf.py | |
parent | 11b88a9ce1e48c3019c7dd4910a73e76ee33f08a (diff) | |
download | ghdl-aec08861c8c24b546be9d95bde3fe3d50926bac0.tar.gz ghdl-aec08861c8c24b546be9d95bde3fe3d50926bac0.tar.bz2 ghdl-aec08861c8c24b546be9d95bde3fe3d50926bac0.zip |
get documentation version from latest Git tag.
Diffstat (limited to 'doc/conf.py')
-rw-r--r-- | doc/conf.py | 21 |
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. |