def get_version():
"""Obtain the packge version from a python file e.g. pkg/__init__.py
See <https://packaging.python.org/en/latest/single_source_version.html>.
"""
file_dir = os.path.realpath(os.path.dirname(__file__))
with open(
os.path.join(file_dir, '..', 'behold', 'version.py')) as f:
txt = f.read()
version_match = re.search(
r"""^__version__ = ['"]([^'"]*)['"]""", txt, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
# 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('.'))
# -- General configuration ------------------------------------------------
评论列表
文章目录