Browse Source

doc: read version from Makefile

Change-Id: I6edb5ee53cdff1c687e97663c93ddaa3b09a9288
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
v1.6-branch
Anas Nashif 9 years ago
parent
commit
8fe98d628e
  1. 34
      doc/conf.py
  2. 2
      doc/index.rst

34
doc/conf.py

@ -52,14 +52,32 @@ project = u'Zephyr Project'
copyright = u'2015, Intel Corporation, Wind River Systems, Inc' copyright = u'2015, Intel Corporation, Wind River Systems, Inc'
author = u'many' author = u'many'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # The following code tries to extract the information by reading the Makefile,
# built documents. # when Sphinx is run directly (e.g. by Read the Docs).
# try:
# The short X.Y version. makefile_version_major = None
version = os.getenv('KERNELVERSION','0.1.0') makefile_version_minor = None
# The full version, including alpha/beta/rc tags. makefile_patchlevel = None
release = os.getenv('KERNELVERSION','0.1.0') for line in open('../Makefile'):
key, val = [x.strip() for x in line.split('=', 2)]
if key == 'VERSION_MAJOR':
makefile_version_major = val
if key == 'VERSION_MINOR':
makefile_version_minor = val
elif key == 'PATCHLEVEL':
makefile_patchlevel = val
if makefile_version_major and makefile_version_minor and makefile_patchlevel:
break
except:
pass
finally:
if makefile_version_major and makefile_version_minor and makefile_patchlevel:
version = release = makefile_version_major + '.' + makefile_version_minor + '.' + makefile_patchlevel
else:
sys.stderr.write('Warning: Could not extract kernel version\n')
version = release = "unknown version"
version = release = os.getenv('KERNELVERSION','0.1.0')
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

2
doc/index.rst

@ -14,7 +14,7 @@ Zephyr Project Documentation
.. only:: (development or daily) .. only:: (development or daily)
Welcome to the Zephyr Project's documentation. This is the documentation of the Welcome to the Zephyr Project's documentation. This is the documentation of the
master tree under development. master tree under development (version |version|).
Documentation for released versions of Zephyr can be found at Documentation for released versions of Zephyr can be found at
``https://www.zephyrproject.org/doc/<version>``. The following documentation ``https://www.zephyrproject.org/doc/<version>``. The following documentation

Loading…
Cancel
Save