From 5502ec97f7d67ffa9c292667b5d53510e7f68521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Thu, 29 Apr 2021 22:41:54 +0200 Subject: [PATCH] packaging: Use current module version for docs Instead of parsing the __init__ file, just assume the package has been installed locally. --- docs/conf.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 4dd2716..25b2811 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,8 @@ import sys, os +import xworkflows + # 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. @@ -48,18 +50,8 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -root_dir = os.path.abspath(os.path.dirname(__file__)) -def get_version(): - import re - version_re = re.compile(r"^__version__ = '([\w_.-]+)'$") - with open(os.path.join(root_dir, os.pardir, 'xworkflows', '__init__.py')) as f: - for line in f: - match = version_re.match(line[:-1]) - if match: - return match.groups()[0] - return '0.0.0' - -release = get_version() +release = xworkflows.__version__ +# The short X.Y version version = '.'.join(release.split('.')[:2])