Package: bootstrap-vz / 0.9.11+20180121git-1

0002-Remove-GitHub-links-from-documentation.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From: Marcin Kulisz <debian@kulisz.net>
Date: Tue, 20 Sep 2016 11:37:39 +0100
Subject: Remove GitHub links from documentation

Links to source code from the documentation are replaced to their counterparts
in GitHub. The problem is that when building the documentation from another
repository which isn't the same as the upstream, those links become broken.
Author: Tiago Ilieve <tiago.myhro@gmail.com>
---
 docs/conf.py | 56 --------------------------------------------------------
 1 file changed, 56 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 26658da..093ed43 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -30,8 +30,6 @@ sys.path.insert(0, os.path.abspath(os.pardir))
 # ones.
 extensions = ['sphinx.ext.coverage',
               'sphinx.ext.autodoc',
-              'sphinx.ext.linkcode',
-              'docs.transform_github_links',
               ]
 
 # Add any paths that contain templates here, relative to this directory.
@@ -294,57 +292,3 @@ for readme_path in glob.glob('../tests/system/providers/*/README.rst'):
         path_to_readme = os.path.join('../../../tests/system/providers', provider_name, 'README.rst')
         with open(include_path, 'w') as include:
             include.write('.. include:: ' + path_to_readme)
-
-
-# -- Substitute links for github with relative links in readthedocs -------
-
-
-if on_rtd:
-    pass
-
-# Snatched from here:
-# https://sourcegraph.com/github.com/Gallopsled/pwntools@master/.PipPackage/pwntools/.def/docs/source/conf/linkcode_resolve/lines
-baseurl = 'https://github.com/andsens/bootstrap-vz'
-
-import subprocess
-try:
-    git_head = subprocess.check_output('git describe --tags 2>/dev/null', shell=True)
-except subprocess.CalledProcessError:
-    try:
-        git_head = subprocess.check_output('git rev-parse HEAD', shell=True).strip()[:10]
-    except subprocess.CalledProcessError:
-        pass
-
-
-def linkcode_resolve(domain, info):
-    if domain != 'py':
-        return None
-    if not info['module']:
-        return None
-
-    filepath = info['module'].replace('.', '/') + '.py'
-    fmt_args = {'baseurl': baseurl,
-                'commit': git_head,
-                'path': filepath}
-
-    import importlib
-    import inspect
-    import types
-    module = importlib.import_module(info['module'])
-    value = module
-    for part in info['fullname'].split('.'):
-        value = getattr(value, part, None)
-        if value is None:
-            break
-    valid_types = (types.ModuleType, types.ClassType, types.MethodType,
-                   types.FunctionType, types.TracebackType,
-                   types.FrameType, types.CodeType)
-    if isinstance(value, valid_types):
-        try:
-            lines, first = inspect.getsourcelines(value)
-            fmt_args['linestart'] = first
-            fmt_args['lineend'] = first + len(lines) - 1
-            return '{baseurl}/blob/{commit}/{path}#L{linestart}-L{lineend}'.format(**fmt_args)
-        except IOError:
-            pass
-    return '{baseurl}/blob/{commit}/{path}'.format(**fmt_args)