本文整理汇总了Python中pbr.version.VersionInfo方法的典型用法代码示例。如果您正苦于以下问题:Python version.VersionInfo方法的具体用法?Python version.VersionInfo怎么用?Python version.VersionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pbr.version
的用法示例。
在下文中一共展示了version.VersionInfo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_setup_file
# 需要导入模块: from pbr import version [as 别名]
# 或者: from pbr.version import VersionInfo [as 别名]
def create_setup_file():
lib_version = VersionInfo("spotify_tensorflow").version_string()
contents_for_setup_file = """
import setuptools
if __name__ == "__main__":
setuptools.setup(
name="spotify_tensorflow_dataflow",
packages=setuptools.find_packages(),
install_requires=[
"spotify-tensorflow=={version}"
])
""".format(version=lib_version) # noqa: W293
setup_file_path = os.path.join(tempfile.mkdtemp(), "setup.py")
with open(setup_file_path, "w") as f:
f.writelines(textwrap.dedent(contents_for_setup_file))
return setup_file_path
示例2: run
# 需要导入模块: from pbr import version [as 别名]
# 或者: from pbr.version import VersionInfo [as 别名]
def run(self):
log.info("[pbr] Extracting rpm version")
name = self.distribution.get_name()
print(version.VersionInfo(name).semantic_version().rpm_string())
示例3: print_version
# 需要导入模块: from pbr import version [as 别名]
# 或者: from pbr.version import VersionInfo [as 别名]
def print_version():
"""Print version number and exit."""
from pbr.version import VersionInfo
version = VersionInfo('faucet').semantic_version().release_string()
message = 'Faucet %s' % version
print(message)
示例4: __init__
# 需要导入模块: from pbr import version [as 别名]
# 或者: from pbr.version import VersionInfo [as 别名]
def __init__(self, reg=None):
if reg is not None:
self._reg = reg
self.version = VersionInfo('faucet').semantic_version().release_string()
self.faucet_version = PromGauge( # pylint: disable=unexpected-keyword-arg
'faucet_pbr_version',
'Faucet PBR version',
['version'],
registry=self._reg)
self.faucet_version.labels(version=self.version).set(1) # pylint: disable=no-member
self.server = None
self.thread = None
示例5: inject_common_paths
# 需要导入模块: from pbr import version [as 别名]
# 或者: from pbr.version import VersionInfo [as 别名]
def inject_common_paths():
"""Discover the path to the common/ directory provided by infrared core."""
def override_conf_path(common_path, envvar, specific_dir):
conf_path = os.environ.get(envvar, '')
additional_conf_path = os.path.join(common_path, specific_dir)
if conf_path:
full_conf_path = ':'.join([additional_conf_path, conf_path])
else:
full_conf_path = additional_conf_path
os.environ[envvar] = full_conf_path
version_info = version.VersionInfo('infrared')
common_path = pkg.resource_filename(version_info.package,
'common')
override_conf_path(common_path, 'ANSIBLE_ROLES_PATH', 'roles')
override_conf_path(common_path, 'ANSIBLE_FILTER_PLUGINS', 'filter_plugins')
override_conf_path(common_path, 'ANSIBLE_CALLBACK_PLUGINS',
'callback_plugins')
override_conf_path(common_path, 'ANSIBLE_LIBRARY', 'library')
# This needs to be called here because as soon as an ansible class is loaded
# the code in constants.py is triggered. That code reads the configuration
# settings from all sources (ansible.cfg, environment variables, etc).
# If the first include to ansible modules is moved deeper in the InfraRed
# code (or on demand), then this call can be moved as well in that place.