From 072fff90f119375395a9b1b2fbef9667a46f7236 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 15 Oct 2016 18:00:21 -0700 Subject: [PATCH] docs: link to correct tag --- docs/conf.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ef5f05566..e1cbc4976 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", '') )