diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-02-18 07:28:38 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-02-18 07:28:38 +0100 |
commit | e097ab4d005657c27c4c205115fea9fd21917f16 (patch) | |
tree | d74f15c222732e55e3e2730bea3072382bdf011a | |
parent | e0698d365ed8697e11f1c69df86a5e0247f110fd (diff) | |
download | ghdl-e097ab4d005657c27c4c205115fea9fd21917f16.tar.gz ghdl-e097ab4d005657c27c4c205115fea9fd21917f16.tar.bz2 ghdl-e097ab4d005657c27c4c205115fea9fd21917f16.zip |
doc/conf.py: get version from git describe
-rw-r--r-- | doc/conf.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/doc/conf.py b/doc/conf.py index 6f7af9c0a..312e8398e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -16,6 +16,7 @@ import sys import os import shlex import re +import subprocess # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -56,28 +57,26 @@ author = u'Tristan Gingold' # built documents. # def _IsUnderGitControl(): - return (check_output(["git", "rev-parse", "--is-inside-work-tree"], universal_newlines=True).strip() == "true") + return (subprocess.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() - -print "file:" + __file__ -print "cwd:" + os.getcwd() + return subprocess.check_output(["git", "describe", "--abbrev=0", "--tags"], universal_newlines=True).strip() try: if _IsUnderGitControl: - latestTagName = _LatestTagName()[1:] # remove prefix "v" - versionParts = latestTagName.split("-")[0].split(".") - - version = ".".join(versionParts[:2]) - #release = ".".join(versionParts[:3]) + descr = _LatestTagName() + if descr.startswith('v'): + version = descr[1:] # remove prefix "v" + else: + version = descr else: with open('../src/version.in') as verin: for line in verin: line = re.findall(r'Ghdl_Ver.+\"(.+)\";', line) if line: version=line[0] -except: +except Exception, e: + print "cannot extract version: %s" % e version = "latest" pass |