|
11 | 11 | # All configuration values have a default; values that are commented out
|
12 | 12 | # serve to show the default.
|
13 | 13 |
|
14 |
| -import sys, os |
| 14 | +import xml.etree.ElementTree as ET |
| 15 | + |
| 16 | +from sphinx.util import logging |
| 17 | +logger = logging.getLogger(__name__) |
15 | 18 |
|
16 | 19 | # If extensions (or modules to document with autodoc) are in another directory,
|
17 | 20 | # add these directories to sys.path here. If the directory is relative to the
|
|
40 | 43 | master_doc = 'index'
|
41 | 44 |
|
42 | 45 | # General information about the project.
|
43 |
| -project = u'Phoebus' |
44 |
| -copyright = u'2017, Phoebus Developers' |
| 46 | +project = 'Phoebus' |
| 47 | +copyright = '2017-%Y, Phoebus Developers' |
| 48 | + |
| 49 | +def find_phoebus_version() -> str: |
| 50 | + try: |
| 51 | + pom = ET.parse("../../pom.xml") |
| 52 | + version_el = pom.find("./{http://maven.apache.org/POM/4.0.0}version") |
| 53 | + |
| 54 | + if version_el is not None and version_el.text is not None: |
| 55 | + return version_el.text |
| 56 | + else: |
| 57 | + raise RuntimeError("Couldn't find a valid <version> in pom.xml") |
| 58 | + except Exception: |
| 59 | + logger.exception("Couldn't find Phoebus version, using a default value") |
| 60 | + return "1.0" |
45 | 61 |
|
46 | 62 | # The version info for the project you're documenting, acts as replacement for
|
47 | 63 | # |version| and |release|, also used in various other places throughout the
|
48 | 64 | # built documents.
|
49 |
| -# |
50 |
| -# The short X.Y version. |
51 |
| -version = '1.0' |
52 |
| -# The full version, including alpha/beta/rc tags. |
53 |
| -release = '1.0' |
| 65 | +version = find_phoebus_version() |
| 66 | +release = version |
54 | 67 |
|
55 | 68 | # The language for content autogenerated by Sphinx. Refer to documentation
|
56 | 69 | # for a list of supported languages.
|
|
248 | 261 | # Create applications.rst, services.rst
|
249 | 262 | # by listing links to all app/**/index.rst
|
250 | 263 |
|
| 264 | +import os |
251 | 265 | from os import walk, path
|
252 | 266 | import subprocess, shutil
|
253 | 267 | import sys, traceback
|
|
0 commit comments