|
37 | 37 | import re
|
38 | 38 | import control
|
39 | 39 |
|
| 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 | + |
40 | 43 | # 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) |
42 | 45 |
|
43 |
| -# The full version, including alpha/beta/rc tags |
44 |
| -release = control.__version__ |
45 | 46 | print("version %s, release %s" % (version, release))
|
46 | 47 |
|
47 | 48 | # -- General configuration ---------------------------------------------------
|
@@ -206,11 +207,10 @@ def linkcode_resolve(domain, info):
|
206 | 207 | linespec = ""
|
207 | 208 |
|
208 | 209 | base_url = "https://github.com/python-control/python-control/blob/"
|
209 |
| - if 'dev' in control.__version__: |
| 210 | + if release != version: # development release |
210 | 211 | 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) |
214 | 214 |
|
215 | 215 | # Don't automaticall show all members of class in Methods & Attributes section
|
216 | 216 | numpydoc_show_class_members = False
|
|
0 commit comments