Commit 8fe98d62 authored by Anas Nashif's avatar Anas Nashif
Browse files

doc: read version from Makefile



Change-Id: I6edb5ee53cdff1c687e97663c93ddaa3b09a9288
Signed-off-by: default avatarAnas Nashif <anas.nashif@intel.com>
parent fee53226
Loading
Loading
Loading
Loading
+26 −8
Original line number Diff line number Diff line
@@ -52,14 +52,32 @@ project = u'Zephyr Project'
copyright = u'2015, Intel Corporation, Wind River Systems, Inc'
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
# built documents.
#
# The short X.Y version.
version = os.getenv('KERNELVERSION','0.1.0')
# The full version, including alpha/beta/rc tags.
release = os.getenv('KERNELVERSION','0.1.0')

# The following code tries to extract the information by reading the Makefile,
# when Sphinx is run directly (e.g. by Read the Docs).
try:
    makefile_version_major = None
    makefile_version_minor = None
    makefile_patchlevel = None
    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
# for a list of supported languages.
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ Zephyr Project Documentation
.. only:: (development or daily)

   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
   ``https://www.zephyrproject.org/doc/<version>``. The following documentation