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
18
docs/conf.py
18
docs/conf.py
@ -56,14 +56,20 @@ 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"):
|
||||||
for line in f:
|
f = open("../lorax.spec", "rt")
|
||||||
m = version_re.match(line)
|
elif os.path.exists("../lorax-composer.spec"):
|
||||||
if m:
|
f = open("../lorax-composer.spec", "rt")
|
||||||
return m.group(1)
|
else:
|
||||||
|
raise RuntimeError("Sphinx read_version() Cannot find lorax.spec or lorax-composer.spec")
|
||||||
|
|
||||||
|
for line in f:
|
||||||
|
m = version_re.match(line)
|
||||||
|
if m:
|
||||||
|
return m.group(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
|
Loading…
Reference in New Issue
Block a user