From aa34d3d3a0e1c5da16d8f6217cbcc2214d76b625 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Mon, 8 Aug 2022 22:33:00 +0200 Subject: [PATCH] docs: obtain version of nutils via import This patches replaces the parsing of the Nutils version number from `__init__.py` with importing `nutils` and obtaining module attribute `version`. There are two motivations for this change: Sphinx is going to import `nutils` anyhow, and in a follow-up commit the line in `__init__.py` defining the version will be changed, which would necessitate a corresponding change to `docs/conf.py` without this patch. --- docs/conf.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e945b0a5e..f59e059d9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,8 +66,7 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -with open(os.path.join('..', 'nutils', '__init__.py'), encoding='utf-8') as f: - nutils_version = next(filter(None, map(re.compile("^version = '([a-zA-Z0-9.]+)'$").match, f))).group(1) +from nutils import version as nutils_version # The short X.Y version. version = re.search('^[0-9]+\\.[0-9]+', nutils_version).group(0) # The full version, including alpha/beta/rc tags.