Skip to content

Commit d11c700

Browse files
committed
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.
1 parent 03eda51 commit d11c700

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

docs/source/conf.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
import sys
1111
from pathlib import Path
1212

13-
# parse info from project files
13+
import sigmf
1414

15-
root = Path(__file__).parent.parent.parent
16-
with open(root / "sigmf" / "__init__.py", "r") as handle:
17-
init = handle.read()
18-
toolversion = re.search(r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', init).group(1)
19-
specversion = re.search(r'__specification__\s*=\s*[\'"]([^\'"]*)[\'"]', init).group(1)
15+
toolversion = sigmf.__version__
16+
specversion = sigmf.__specification__
2017

2118
# autodoc needs special pathing
2219
sys.path.append(str(root))
@@ -68,4 +65,4 @@
6865
]
6966
frozen_locals = dict(locals())
7067
rst_epilog = '\n'.join(map(lambda x: f".. |{x}| replace:: {frozen_locals[x]}", variables_to_export))
71-
del frozen_locals
68+
del frozen_locals

0 commit comments

Comments
 (0)