From 5b67d9a2bd3607b673ea9d91fc6d6eb9324d2cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Est=C3=A9vez?= Date: Sat, 17 May 2025 10:06:33 +0200 Subject: [PATCH] docs: import version and specification version from sigmf Rather than parsing __init__.py, import the Python module and grab the values from there. This should work as long as sigmf-python is installed in the venv used to build the docs. --- docs/source/conf.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2c1c9f4..320ee99 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -10,15 +10,13 @@ import sys from pathlib import Path -# parse info from project files +import sigmf -root = Path(__file__).parent.parent.parent -with open(root / "sigmf" / "__init__.py", "r") as handle: - init = handle.read() - toolversion = re.search(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', init).group(1) - specversion = re.search(r'__specification__\s*=\s*[\'"]([^\'"]*)[\'"]', init).group(1) +toolversion = sigmf.__version__ +specversion = sigmf.__specification__ # autodoc needs special pathing +root = Path(__file__).parent.parent.parent sys.path.append(str(root)) # -- Project information @@ -68,4 +66,4 @@ ] frozen_locals = dict(locals()) rst_epilog = '\n'.join(map(lambda x: f".. |{x}| replace:: {frozen_locals[x]}", variables_to_export)) -del frozen_locals \ No newline at end of file +del frozen_locals