From d824d63b97572e192cd7f974acc2a209b88eae18 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Mon, 4 Jun 2018 16:25:33 -0700 Subject: [PATCH] Override Sphinx documentation version with LORAX_VERSION Normally you want to document the NEXT release, not the last. This allows you to build the documentation using: LORAX_VERSION="29.6" make docs (cherry picked from commit d47d38e0c84acaac539d904f1b615bae59253691) --- docs/conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 7f8957ef..fbf68cf6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,7 +57,11 @@ copyright = u'2018, Red Hat, Inc.' # pylint: disable=redefined-builtin # |version| and |release|, also used in various other places throughout the # built documents. def read_version(): - """ Read version from ../lorax.spec""" + """Read version from $LORAX_VERSION or ../lorax.spec""" + # This allows the .spec version to be overridded. eg. when documenting an upcoming release + if "LORAX_VERSION" in os.environ: + return os.environ["LORAX_VERSION"] + import re version_re = re.compile(r"Version:\s+(.*)") with open("../lorax.spec", "rt") as f: