Provide extension version

This can be useful for debugging purposes, though others may also use it
if they wish to depend on the extension for some reason.

Change-Id: I485201946dfb486a0045ac36fced7c3c27673f4f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2020-05-15 16:54:47 +01:00
parent 31642dd188
commit f7fe7daea6
4 changed files with 19 additions and 4 deletions

View File

@ -12,9 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from . import ext # noqa from . import ext
from . import page_context # noqa from . import page_context
from .paths import * # noqa from .paths import * # noqa
from .version import version_info
__version__ = version_info.version_string()
def setup(app): def setup(app):
@ -23,4 +27,5 @@ def setup(app):
return { return {
'parallel_read_safe': True, 'parallel_read_safe': True,
'parallel_write_safe': True, 'parallel_write_safe': True,
'version': __version__,
} }

View File

@ -25,6 +25,7 @@ from pbr import packaging
from sphinx.ext import extlinks from sphinx.ext import extlinks
from sphinx.util import logging from sphinx.util import logging
from . import version
from openstackdocstheme import paths from openstackdocstheme import paths
_series = None _series = None
@ -308,7 +309,11 @@ def _get_project_name(srcdir):
def _builder_inited(app): def _builder_inited(app):
theme_dir = paths.get_html_theme_path() theme_dir = paths.get_html_theme_path()
logger.info('Using openstackdocstheme Sphinx theme from %s' % theme_dir) logger.info(
'[openstackdocstheme] using theme from %s (version %s)',
theme_dir,
version.version_info.version_string(),
)
if app.config.openstack_projects is not None: if app.config.openstack_projects is not None:
logger.info( logger.info(
@ -449,4 +454,5 @@ def setup(app):
return { return {
'parallel_read_safe': True, 'parallel_read_safe': True,
'parallel_write_safe': True, 'parallel_write_safe': True,
'version': version.version_info.version_string(),
} }

View File

@ -18,6 +18,9 @@ import time
from sphinx.util import logging from sphinx.util import logging
from . import version
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
_timeint = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) _timeint = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
@ -99,4 +102,5 @@ def setup(app):
return { return {
'parallel_read_safe': True, 'parallel_read_safe': True,
'parallel_write_safe': True, 'parallel_write_safe': True,
'version': version.version_info.version_string(),
} }

View File

@ -14,4 +14,4 @@
import pbr.version import pbr.version
version_info = pbr.version.VersionInfo('openstackdoctheme') version_info = pbr.version.VersionInfo('openstackdocstheme')