aboutsummaryrefslogtreecommitdiffstats
path: root/docs/conf.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-15 18:00:21 -0700
committerAldo Cortesi <aldo@nullcube.com>2016-10-16 20:26:06 +1300
commit072fff90f119375395a9b1b2fbef9667a46f7236 (patch)
tree832d0c6dce70a9d0c63254113b7a7c257d395a3c /docs/conf.py
parent55cb2a85472de8698b3dabc7ddc920b930e355d9 (diff)
downloadmitmproxy-072fff90f119375395a9b1b2fbef9667a46f7236.tar.gz
mitmproxy-072fff90f119375395a9b1b2fbef9667a46f7236.tar.bz2
mitmproxy-072fff90f119375395a9b1b2fbef9667a46f7236.zip
docs: link to correct tag
Diffstat (limited to 'docs/conf.py')
-rw-r--r--docs/conf.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/docs/conf.py b/docs/conf.py
index ef5f0556..e1cbc497 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,9 @@
-import sys
-import os
import importlib
import inspect
+import os
+import subprocess
+import sys
+
sys.path.insert(0, os.path.abspath('..'))
import netlib.version
@@ -194,11 +196,20 @@ html_show_sourcelink = False
# Output file base name for HTML help builder.
htmlhelp_basename = 'mitmproxydoc'
+last_tag, tag_dist, commit = (
+ subprocess.check_output(["git", "describe", "--tags", "--long"])
+ .decode()
+ .strip()
+ .rsplit("-", 2)
+)
+tag_dist = int(tag_dist)
+if tag_dist == 0:
+ tag = last_tag
+else:
+ tag = "master"
-SRCBASE = "https://github.com/mitmproxy/mitmproxy/blob/master"
-
+SRCBASE = "https://github.com/mitmproxy/mitmproxy/blob/{}".format(tag)
-# FIXME: change master to dynamic version before release
extlinks = dict(
src = (SRCBASE + r"/%s", '')
)