Extract version definition to a separate file
Before, version was stores in the init file. It's better not to store such kind of public data as version to init file. Moreover, whole murano package needed to be imported to identify project version Now, separate file is used for that Also, doc builder config was updated to support this change Change-Id: Iede1dfbe9ae4d8c6fb5ecdeb8f8f25124e4bc34f
This commit is contained in:
parent
e8dd9b799c
commit
552f04a674
|
@ -15,15 +15,16 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.abspath('../../'))
|
||||
sys.path.insert(0, os.path.abspath('../../murano'))
|
||||
sys.path.insert(0, os.path.abspath('../'))
|
||||
sys.path.insert(0, os.path.abspath('./'))
|
||||
sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
from murano import __version_info as version
|
||||
|
||||
from murano.version import version_info
|
||||
|
||||
# Supress warnings for docs that aren't used yet
|
||||
#unused_docs = [
|
||||
|
@ -55,8 +56,8 @@ project = 'Murano'
|
|||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
release = version.version_string()
|
||||
version = version.canonical_version_string()
|
||||
release = version_info.release_string()
|
||||
version = version_info.version_string()
|
||||
|
||||
# Set the default Pygments syntax
|
||||
highlight_language = 'python'
|
||||
|
@ -73,8 +74,20 @@ show_authors = False
|
|||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme_path = ['.']
|
||||
html_theme = '_theme'
|
||||
if on_rtd:
|
||||
html_theme_path = ['.']
|
||||
html_theme = '_theme_rtd'
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
git_cmd = "git log --pretty=format:'%ad, commit %h' --date=local -n1"
|
||||
html_last_updated_fmt = os.popen(git_cmd).read()
|
||||
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
html_title = 'Murano'
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
html_sidebars = {
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from murano.openstack.common.gettextutils import _ # noqa
|
||||
|
||||
from pbr import version
|
||||
__version_info = version.VersionInfo('murano')
|
||||
__version__ = __version_info.cached_version_string()
|
|
@ -24,12 +24,11 @@ import traceback
|
|||
from oslo.config import cfg
|
||||
from oslo.db import exception as db_exception
|
||||
|
||||
import murano
|
||||
from murano.common import consts
|
||||
from murano.db.catalog import api as db_catalog_api
|
||||
from murano.openstack.common import log as logging
|
||||
from murano.packages import load_utils
|
||||
|
||||
from murano import version
|
||||
|
||||
CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -151,7 +150,7 @@ def main():
|
|||
try:
|
||||
default_config_files = cfg.find_config_files('murano', 'murano')
|
||||
CONF(sys.argv[1:], project='murano', prog='murano-manage',
|
||||
version=murano.__version__,
|
||||
version=version.version_string,
|
||||
default_config_files=default_config_files)
|
||||
logging.setup("murano")
|
||||
except RuntimeError as e:
|
||||
|
|
|
@ -25,8 +25,8 @@ import sys
|
|||
from oslo.config import cfg
|
||||
from paste import deploy
|
||||
|
||||
import murano
|
||||
from murano.openstack.common.gettextutils import _ # noqa
|
||||
from murano import version
|
||||
|
||||
paste_deploy_opts = [
|
||||
cfg.StrOpt('flavor', help='Paste flavor'),
|
||||
|
@ -222,7 +222,7 @@ CONF.register_opts(networking_opts, group='networking')
|
|||
def parse_args(args=None, usage=None, default_config_files=None):
|
||||
CONF(args=args,
|
||||
project='murano',
|
||||
version=murano.__version__,
|
||||
version=version.version_string,
|
||||
usage=usage,
|
||||
default_config_files=default_config_files)
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Copyright (c) 2014 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from pbr import version
|
||||
|
||||
version_info = version.VersionInfo('murano')
|
||||
version_string = version_info.cached_version_string()
|
Loading…
Reference in New Issue