doc: fix version parsing

Something stopped working after we move to 1.10, this seems to fix it.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2017-12-09 11:20:44 -05:00 committed by Anas Nashif
parent b893dac6b3
commit 7514178df4

View File

@ -53,6 +53,10 @@ project = u'Zephyr Project'
copyright = u'2015-2017 Zephyr Project members and individual contributors.'
author = u'many'
if "ZEPHYR_BASE" not in os.environ:
sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n")
exit(1)
ZEPHYR_BASE = os.environ["ZEPHYR_BASE"]
# The following code tries to extract the information by reading the Makefile,
# when Sphinx is run directly (e.g. by Read the Docs).
@ -61,7 +65,7 @@ try:
version_minor = None
patchlevel = None
extraversion = None
for line in open('../VERSION'):
for line in open(os.path.join(ZEPHYR_BASE, 'VERSION')):
key, val = [x.strip() for x in line.split('=', 2)]
if key == 'VERSION_MAJOR':
version_major = val
@ -76,7 +80,7 @@ try:
except:
pass
finally:
if version_major and version_minor and patchlevel and extraversion:
if version_major and version_minor and patchlevel and extraversion is not None :
version = release = version_major + '.' + version_minor + '.' + patchlevel
if extraversion != '':
version = release = version + '-' + extraversion