From e79da4d73415a3e232fdc16cf2a623bc58c571d5 Mon Sep 17 00:00:00 2001
From: Klaus Zimmermann <klaus_zimmermann@gmx.de>
Date: Wed, 14 Sep 2016 13:25:19 +0200
Subject: Patch sphinx config to avoid network access and add local intersphinx
 links.

Signed-off-by: Klaus Zimmermann <klaus_zimmermann@gmx.de>
---
 docs/source/conf.py | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/docs/source/conf.py b/docs/source/conf.py
index 50084c5..7e24935 100755
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -72,6 +72,30 @@ intersphinx_mapping = {
     'scipy':      ('http://docs.scipy.org/doc/scipy/reference', None),
     }
 
+def check_object_path(key, url, path):
+    if os.path.isfile(path):
+        return {key: (url, path)}
+    return {}
+
+intersphinx_mapping.update(check_object_path('sphinx',
+                                             'http://sphinx.pocoo.org/',
+                                             '/usr/share/doc/sphinx-doc/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('python',
+                                            'http://docs.python.org/',
+                                            '/usr/share/doc/python'
+                                              + '.'.join([str(x) for x in sys.version_info[0:2]])
+                                              + '/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('matplotlib',
+                                             'http://matplotlib.sourceforge.net/',
+                                             '/usr/share/doc/python-matplotlib-doc/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('numpy',
+                                             'http://docs.scipy.org/doc/numpy/',
+                                             '/usr/share/doc/python-numpy-doc/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('scipy',
+                                             'http://docs.scipy.org/doc/scipy/',
+                                             '/usr/share/doc/python-scipy-doc/html/objects.inv'))
+
+
 # The name of the default domain. Can also be None to disable a
 # default domain. The default is 'py'.
 #primary_domain = 'cf'
@@ -324,8 +348,7 @@ def linkcode_resolve(domain, info):
     #=================================================================
 
 
-    online_source_code = True
-#    online_source_code = False
+    online_source_code = False
 
     if domain != 'py':
         return None
