diff mbox

[v2,06/12] doc: automatically get the version

Message ID 20180519125239.89629-7-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck May 19, 2018, 12:52 p.m. UTC
Documentation generated by sphinx reference the version of the
project being documented. This version need to be specified via
sphinx's config file.

However, if this version number is simply added there, it's
guaranteed that soon or later it will be out-of-synch with git's
version tag (or the version number present in the Makefile).

Fix this by trying to read the version from git or, if this fails,
from the Makefile.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 Documentation/conf.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 082cf61a5..cfb0be7fb 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -55,10 +55,10 @@  author = "sparse's development community"
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
-# The short X.Y version.
-version = u'0.5.9'
 # The full version, including alpha/beta/rc tags.
-release = u'0.5.9'
+release = next(open('../Makefile', 'r')).split('=')[1].rstrip()
+# The short X.Y version.
+version = release.split('-')[0]
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.