Fix Sphinx read_version code
It needs to look for ../lorax.spec OR ../lorax-composer.spec
This commit is contained in:
parent
cc4ae5d19b
commit
e56e55bb3b
10
docs/conf.py
10
docs/conf.py
@ -56,10 +56,16 @@ copyright = u'2018, Red Hat, Inc.' # pylint: disable=redefined-builtin
|
|||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
def read_version():
|
def read_version():
|
||||||
""" Read version from ../lorax.spec"""
|
""" Read version from ../lorax.spec or lorax-composer.spec"""
|
||||||
import re
|
import re
|
||||||
version_re = re.compile(r"Version:\s+(.*)")
|
version_re = re.compile(r"Version:\s+(.*)")
|
||||||
with open("../lorax.spec", "rt") as f:
|
if os.path.exists("../lorax.spec"):
|
||||||
|
f = open("../lorax.spec", "rt")
|
||||||
|
elif os.path.exists("../lorax-composer.spec"):
|
||||||
|
f = open("../lorax-composer.spec", "rt")
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Sphinx read_version() Cannot find lorax.spec or lorax-composer.spec")
|
||||||
|
|
||||||
for line in f:
|
for line in f:
|
||||||
m = version_re.match(line)
|
m = version_re.match(line)
|
||||||
if m:
|
if m:
|
||||||
|
Loading…
Reference in New Issue
Block a user