diff --git a/doc/conf.py b/doc/conf.py index 5d92815da56..9700787e1a6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -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