8000 use alternative method to get package version if __version__ is not s… · astyl/spatialmath-python@5e24645 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e24645

Browse files
committed
use alternative method to get package version if __version__ is not set, as happens in GH action
1 parent cdba722 commit 5e24645

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/source/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
project = 'Spatial Maths package'
2323
copyright = '2020-, Peter Corke.'
2424
author = 'Peter Corke'
25-
import spatialmath
26-
version = spatialmath.__version__
27-
28-
# The full version, including alpha/beta/rc tags
29-
# with open('../../RELEASE', encoding='utf-8') as f:
30-
# release = f.read()
31-
# import spatialmath
32-
# release = spatialmath.__version__
25+
try:
26+
import spatialmath
27+
version = spatialmath.__version__
28+
except AttributeError:
29+
import re
30+
with open("../../pyproject.toml", "r") as f:
31+
m = re.compile(r'version\s*=\s*"([0-9\.]+)"').search(f.read())
32+
version = m[1]
3333

3434
# -- General configuration ---------------------------------------------------
3535

0 commit comments

Comments
 (0)
0