From c6ec1a8aed2236224a1d8113be2cfdcaa589c2ed Mon Sep 17 00:00:00 2001
From: Pete Peterson <petersonpf@ornl.gov>
Date: Tue, 6 Oct 2015 16:44:04 -0400
Subject: [PATCH] Banning build directory from list of source locations

---
 docs/sphinxext/mantiddoc/directives/sourcelink.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/sphinxext/mantiddoc/directives/sourcelink.py b/docs/sphinxext/mantiddoc/directives/sourcelink.py
index 689d45e94cf..8ff7598f529 100644
--- a/docs/sphinxext/mantiddoc/directives/sourcelink.py
+++ b/docs/sphinxext/mantiddoc/directives/sourcelink.py
@@ -142,7 +142,14 @@ class SourceLinkDirective(AlgorithmBaseDirective):
         """
         Fills the file_lookup dictionary after parsing the source code
         """
+        env = self.state.document.settings.env
+        builddir = env.doctreedir # there should be a better setting option
+        builddir = os.path.join(builddir, "..", "..")
+        builddir = os.path.abspath(builddir)
+
         for dirName, subdirList, fileList in os.walk(self.source_root):
+            if dirName.startswith(builddir):
+                continue # don't check or add to the cache
             for fname in fileList:
                 (baseName, fileExtension) = os.path.splitext(fname)
                 #strip the dot from the extension
-- 
GitLab