summaryrefslogtreecommitdiffstats
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2016-05-28 08:25:41 -0400
committerJani Nikula <jani.nikula@intel.com>2016-05-30 06:38:53 -0400
commitc13ce448c8532965eb4e1115e78cb5b8ff8261a3 (patch)
tree9045c881acf6badba6f0d32572cd0f845d33c8e9 /Documentation/conf.py
parent24dcdeb28b55afafa9cdf6acedd78cf1aa8f8428 (diff)
Documentation/sphinx: set version and release properly
Read the version and release from the top level Makefile (for use when Sphinx is invoked directly, by e.g. Read the Docs), but override them via Sphinx command line arguments in a normal documentation build. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 8b72577f38f5..6cc41a0555a3 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -60,10 +60,31 @@ author = 'The kernel development community'
60# |version| and |release|, also used in various other places throughout the 60# |version| and |release|, also used in various other places throughout the
61# built documents. 61# built documents.
62# 62#
63# The short X.Y version. 63# In a normal build, version and release are are set to KERNELVERSION and
64version = '4.5' 64# KERNELRELEASE, respectively, from the Makefile via Sphinx command line
65# The full version, including alpha/beta/rc tags. 65# arguments.
66release = '4.5' 66#
67# The following code tries to extract the information by reading the Makefile,
68# when Sphinx is run directly (e.g. by Read the Docs).
69try:
70 makefile_version = None
71 makefile_patchlevel = None
72 for line in open('../Makefile'):
73 key, val = [x.strip() for x in line.split('=', 2)]
74 if key == 'VERSION':
75 makefile_version = val
76 elif key == 'PATCHLEVEL':
77 makefile_patchlevel = val
78 if makefile_version and makefile_patchlevel:
79 break
80except:
81 pass
82finally:
83 if makefile_version and makefile_patchlevel:
84 version = release = makefile_version + '.' + makefile_patchlevel
85 else:
86 sys.stderr.write('Warning: Could not extract kernel version\n')
87 version = release = "unknown version"
67 88
68# The language for content autogenerated by Sphinx. Refer to documentation 89# The language for content autogenerated by Sphinx. Refer to documentation
69# for a list of supported languages. 90# for a list of supported languages.