diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-18 14:16:24 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-23 12:08:56 +0000 |
| commit | b04eda74476fcaaee729ead79322694b3fb5937e (patch) | |
| tree | 6cfcffee8331c0cfba6b6f76d91ae60443dd2cdf /documentation/conf.py | |
| parent | 8d3e9aaede03f3615e5afb82df4d9b530a06a5f0 (diff) | |
| download | poky-b04eda74476fcaaee729ead79322694b3fb5937e.tar.gz | |
conf.py/set_versions/poky.yaml: Set version in conf.py from poky.yaml
Allow conf.py to read the versions it needs from poky.yaml and have
set_versions.py write this out. This means we don't have to change as
many files when making new releases.
(From yocto-docs rev: bfe74c67f327f0c6445cb4129ee0c32db022b95a)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/conf.py')
| -rw-r--r-- | documentation/conf.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/documentation/conf.py b/documentation/conf.py index 3015892d29..a5d7c0cd88 100644 --- a/documentation/conf.py +++ b/documentation/conf.py | |||
| @@ -15,9 +15,27 @@ | |||
| 15 | import os | 15 | import os |
| 16 | import sys | 16 | import sys |
| 17 | import datetime | 17 | import datetime |
| 18 | try: | ||
| 19 | import yaml | ||
| 20 | except ImportError: | ||
| 21 | sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\ | ||
| 22 | \nPlease make sure to install pyyaml python package.\n") | ||
| 23 | sys.exit(1) | ||
| 18 | 24 | ||
| 19 | current_version = "dev" | 25 | # current_version = "dev" |
| 20 | bitbake_version = "" # Leave empty for development branch | 26 | # bitbake_version = "" # Leave empty for development branch |
| 27 | # Obtain versions from poky.yaml instead | ||
| 28 | with open("poky.yaml") as data: | ||
| 29 | buff = data.read() | ||
| 30 | subst_vars = yaml.safe_load(buff) | ||
| 31 | if "DOCCONF_VERSION" not in subst_vars: | ||
| 32 | sys.stderr.write("Please set DOCCONF_VERSION in poky.yaml") | ||
| 33 | sys.exit(1) | ||
| 34 | current_version = subst_vars["DOCCONF_VERSION"] | ||
| 35 | if "BITBAKE_SERIES" not in subst_vars: | ||
| 36 | sys.stderr.write("Please set BITBAKE_SERIES in poky.yaml") | ||
| 37 | sys.exit(1) | ||
| 38 | bitbake_version = subst_vars["BITBAKE_SERIES"] | ||
| 21 | 39 | ||
| 22 | # String used in sidebar | 40 | # String used in sidebar |
| 23 | version = 'Version: ' + current_version | 41 | version = 'Version: ' + current_version |
