8000 fix sphinx version processing to point to released source code · ControlCorp/python-control@1aa6a7e · GitHub
[go: up one dir, main page]

Skip to content

Commit 1aa6a7e

Browse files
committed
fix sphinx version processing to point to released source code
1 parent 423744a commit 1aa6a7e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737
import re
3838
import control
3939

40+
# Get the version number for this commmit (including alpha/beta/rc tags)
41+
release = re.sub('^v', '', os.popen('git describe').read().strip())
42+
4043
# The short X.Y.Z version
41-
version = re.sub(r'(\d+\.\d+\.\d+)(.*)', r'\1', control.__version__)
44+
version = re.sub(r'(\d+\.\d+\.\d+(.post\d+)?)(.*)', r'\1', release)
4245

43-
# The full version, including alpha/beta/rc tags
44-
release = control.__version__
4546
print("version %s, release %s" % (version, release))
4647

4748
# -- General configuration ---------------------------------------------------
@@ -206,11 +207,10 @@ def linkcode_resolve(domain, info):
206207
linespec = ""
207208

208209
base_url = "https://github.com/python-control/python-control/blob/"
209-
if 'dev' in control.__version__:
210+
if release != version: # development release
210211
return base_url + "main/control/%s%s" % (fn, linespec)
211-
else:
212-
return base_url + "%s/control/%s%s" % (
213-
control.__version__, fn, linespec)
212+
else: # specific version
213+
return base_url + "%s/control/%s%s" % (version, fn, linespec)
214214

215215
# Don't automaticall show all members of class in Methods & Attributes section
216216
numpydoc_show_class_members = False

0 commit comments

Comments
 (0)
0