diff options
author | tgingold <tgingold@users.noreply.github.com> | 2016-12-11 07:19:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-11 07:19:54 +0100 |
commit | abc2498fb436c7405eda0dc1ec858fcd0584ebe9 (patch) | |
tree | 78b359de105514050697ce96945b5810f92bcf6b /doc | |
parent | 11b88a9ce1e48c3019c7dd4910a73e76ee33f08a (diff) | |
parent | aec08861c8c24b546be9d95bde3fe3d50926bac0 (diff) | |
download | ghdl-abc2498fb436c7405eda0dc1ec858fcd0584ebe9.tar.gz ghdl-abc2498fb436c7405eda0dc1ec858fcd0584ebe9.tar.bz2 ghdl-abc2498fb436c7405eda0dc1ec858fcd0584ebe9.zip |
Merge pull request #217 from Paebbels/paebbels/docs-version
Get documentation version from latest Git tag.
Diffstat (limited to 'doc')
-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. |