X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=docs%2Fconf.py;h=5bbe39f167dfc2c020e7b4478923122c6e5b4db2;hb=ddd8f4dd3b86b15eb45da9f5f65b16f890b7f60e;hp=dea371d8a46907ede17e418fdb55ed407ef25a60;hpb=56b5f9659c5803cb136b2ed624e9c38f479133ec;p=releng%2Fglobal-jjb.git diff --git a/docs/conf.py b/docs/conf.py index dea371d8..5bbe39f1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,10 +18,24 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os +import subprocess import sys import sphinx_bootstrap_theme + sys.path.insert(0, os.path.abspath('..')) + +def format_version(version): + fmt = '{tag}.dev{commitcount}+{gitsha}' + parts = version.split('-') + assert len(parts) in (3, 4) + dirty = len(parts) == 4 + tag, count, sha = parts[:3] + if count == '0' and not dirty: + return tag + return fmt.format(tag=tag, commitcount=count, gitsha=sha.lstrip('g')) + + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -32,6 +46,7 @@ sys.path.insert(0, os.path.abspath('..')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ + 'reno.sphinxext', 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', @@ -67,7 +82,13 @@ author = 'Linux Foundation Releng' # built documents. # # The short X.Y version. -version = '0.11.0-dev' +command = 'git describe --tags --long --dirty' +try: + git_version = format_version( + subprocess.check_output(command.split()).decode('utf-8').strip()) +except subprocess.CalledProcessError: # Handle docs builds from tarball + git_version = "v0.0.9999-local" +version = git_version # The full version, including alpha/beta/rc tags. release = version @@ -255,7 +276,7 @@ htmlhelp_basename = 'LinuxFoundationReleaseEngineeringGJJBdoc' # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { + 'jjb': ('https://docs.openstack.org/infra/jenkins-job-builder/', None), 'lftools': ('http://lftools.releng.linuxfoundation.org/en/latest/', None), 'python': ('https://docs.python.org/', None), } -