Index: docs/sphinx-docs/build_sphinx.py
===================================================================
--- docs/sphinx-docs/build_sphinx.py	(revision 01f1e174e9a9bcc2a3ecebc3d6448a75d9028016)
+++ docs/sphinx-docs/build_sphinx.py	(revision 0e2d287273aef0664102131b53b837d798c0b9cb)
@@ -21,5 +21,5 @@
 from os import listdir
 
-platform = '.%s-%s'%(get_platform(),sys.version[:3])
+platform = '.%s-%s'%(get_platform(), sys.version[:3])
 
 CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -46,5 +46,5 @@
 SASMODELS_SOURCE_MODELS = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model")
 SASMODELS_SOURCE_IMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "model", "img")
-SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html","_images")
+SASMODELS_SOURCE_AUTOIMG = os.path.join(CURRENT_SCRIPT_DIR, "..", "..", "..", "sasmodels", "doc", "_build", "html", "_images")
 ## Don't do assemble-in-place
 ## Assemble the docs in a temporary folder
@@ -73,14 +73,14 @@
 def inplace_change(filename, old_string, new_string):
 # Thanks to http://stackoverflow.com/questions/4128144/replace-string-within-file-contents
-        s=open(filename).read()
-        if old_string in s:
-                print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
-                s=s.replace(old_string, new_string)
-                f=open(filename, 'w')
-                f.write(s)
-                f.flush()
-                f.close()
-        else:
-                print('No occurences of "{old_string}" found.'.format(**locals()))
+    s = open(filename).read()
+    if old_string in s:
+        print('Changing "{old_string}" to "{new_string}"'.format(**locals()))
+        s = s.replace(old_string, new_string)
+        f = open(filename, 'w')
+        f.write(s)
+        f.flush()
+        f.close()
+    else:
+        print('No occurences of "{old_string}" found.'.format(**locals()))
 
 def _remove_dir(dir_path):
@@ -109,6 +109,6 @@
     print("=== Copying Source toctrees ===")
     if os.path.exists(SASVIEW_TOC_SOURCE):
-       print("Found docs folder at", SASVIEW_TOC_SOURCE)
-       shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
+        print("Found docs folder at", SASVIEW_TOC_SOURCE)
+        shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
 
 def retrieve_user_docs():
@@ -147,10 +147,11 @@
     print("=== Including Test Data Docs ===")
     if os.path.exists(SASVIEW_TEST):
-       print("Found docs folder at", SASVIEW_TEST)
-       shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
+        print("Found docs folder at", SASVIEW_TEST)
+        shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
 
     print("=== And the Sasmodels Docs ===")
     # Make sure we have the relevant images for the new sasmodels documentation
-    # First(!) we'll make a local reference copy for SasView (/new-models will be cleaned each build)
+    # First(!) we'll make a local reference copy for SasView
+    # (/new-models will be cleaned each build)
     if os.path.exists(SASMODELS_SOURCE_IMG):
         print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG)
@@ -163,9 +164,9 @@
         print("Copying sasmodels model image files...")
         for files in os.listdir(SASMODELS_SOURCE_IMG):
-            fromhere=os.path.join(SASMODELS_SOURCE_IMG,files)
-            tohere=os.path.join(SASMODELS_DEST_IMG,files)
-            shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_IMG,"was found")
+            fromhere = os.path.join(SASMODELS_SOURCE_IMG, files)
+            tohere = os.path.join(SASMODELS_DEST_IMG, files)
+            shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_IMG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_AUTOIMG):
@@ -177,9 +178,9 @@
         print("Copying sasmodels model auto-generated image files...")
         for files in os.listdir(SASMODELS_SOURCE_AUTOIMG):
-            fromhere=os.path.join(SASMODELS_SOURCE_AUTOIMG,files)
-            tohere=os.path.join(SASMODELS_DEST_IMG,files)
-            shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found")
+            fromhere = os.path.join(SASMODELS_SOURCE_AUTOIMG, files)
+            tohere = os.path.join(SASMODELS_DEST_IMG, files)
+            shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_AUTOIMG, "was found")
 
     # And the rst prolog with the unit substitutions
@@ -191,9 +192,9 @@
             for files in os.listdir(SASMODELS_SOURCE_PROLOG):
                 if files.startswith("rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_PROLOG,files)
-                    tohere=os.path.join(SASMODELS_DEST_PROLOG,files)
-                    shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_PROLOG, "was found")
+                    fromhere = os.path.join(SASMODELS_SOURCE_PROLOG, files)
+                    tohere = os.path.join(SASMODELS_DEST_PROLOG, files)
+                    shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_PROLOG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_GPU):
@@ -204,9 +205,9 @@
             for files in os.listdir(SASMODELS_SOURCE_GPU):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_GPU,files)
-                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
-                    shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_GPU,"was found")
+                    fromhere = os.path.join(SASMODELS_SOURCE_GPU, files)
+                    tohere = os.path.join(SPHINX_SOURCE_USER, files)
+                    shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_GPU, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANS):
@@ -217,9 +218,9 @@
             for files in os.listdir(SASMODELS_SOURCE_SESANS):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_SESANS,files)
-                    tohere=os.path.join(SPHINX_SOURCE_USER,files)
-                    shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_SESANS,"was found")
+                    fromhere = os.path.join(SASMODELS_SOURCE_SESANS, files)
+                    tohere = os.path.join(SPHINX_SOURCE_USER, files)
+                    shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_SESANS, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGNETISM):
@@ -230,9 +231,9 @@
             for files in os.listdir(SASMODELS_SOURCE_MAGNETISM):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_MAGNETISM,files)
-                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
-                    shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found")
+                    fromhere = os.path.join(SASMODELS_SOURCE_MAGNETISM, files)
+                    tohere = os.path.join(SASMODELS_DEST_REF_MODELS, files)
+                    shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_MAGNETISM, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGIMG):
@@ -244,9 +245,9 @@
         print("Copying sasmodels mag image files...")
         for files in os.listdir(SASMODELS_SOURCE_MAGIMG):
-            fromhere=os.path.join(SASMODELS_SOURCE_MAGIMG,files)
-            tohere=os.path.join(SASMODELS_DEST_MAGIMG,files)
-            shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found")
+            fromhere = os.path.join(SASMODELS_SOURCE_MAGIMG, files)
+            tohere = os.path.join(SASMODELS_DEST_MAGIMG, files)
+            shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_MAGIMG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANSIMG):
@@ -258,9 +259,9 @@
         print("Copying sasmodels sesans image files...")
         for files in os.listdir(SASMODELS_SOURCE_SESANSIMG):
-            fromhere=os.path.join(SASMODELS_SOURCE_SESANSIMG,files)
-            tohere=os.path.join(SASMODELS_DEST_SESANSIMG,files)
-            shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found")
+            fromhere = os.path.join(SASMODELS_SOURCE_SESANSIMG, files)
+            tohere = os.path.join(SASMODELS_DEST_SESANSIMG, files)
+            shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_SESANSIMG, "was found")
 
     if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
@@ -271,7 +272,7 @@
             for files in os.listdir(SASMODELS_SOURCE_REF_MODELS):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_REF_MODELS,files)
-                    tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
-                    shutil.copy(fromhere,tohere)
+                    fromhere = os.path.join(SASMODELS_SOURCE_REF_MODELS, files)
+                    tohere = os.path.join(SASMODELS_DEST_REF_MODELS, files)
+                    shutil.copy(fromhere, tohere)
             # But need to change the path to the model docs in the tocs
             for files in os.listdir(SASMODELS_DEST_REF_MODELS):
@@ -279,16 +280,16 @@
                 if files.startswith("shape"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
                 if files.startswith("sphere"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
                 if files.startswith("custom"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
                 if files.startswith("structure"):
                     print("Changing toc paths in", files)
-                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
-    else:
-        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found")
+                    inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS, files), "../../model/", "models/")
+    else:
+        print("no source directory", SASMODELS_SOURCE_REF_MODELS, " was found")
 
     if os.path.exists(SASMODELS_SOURCE_MODELS):
@@ -299,7 +300,7 @@
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
-                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
-                    shutil.copy(fromhere,tohere)
+                    fromhere = os.path.join(SASMODELS_SOURCE_MODELS, files)
+                    tohere = os.path.join(SASMODELS_DEST_MODELS, files)
+                    shutil.copy(fromhere, tohere)
         else:
             print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
@@ -311,15 +312,15 @@
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
-                    fromhere=os.path.join(SASMODELS_SOURCE_MODELS,files)
-                    tohere=os.path.join(SASMODELS_DEST_MODELS,files)
-                    shutil.copy(fromhere,tohere)
+                    fromhere = os.path.join(SASMODELS_SOURCE_MODELS, files)
+                    tohere = os.path.join(SASMODELS_DEST_MODELS, files)
+                    shutil.copy(fromhere, tohere)
             # No choice but to do this because model files are all coded for images in /models/img
             print("Copying image files for build...")
             for files in os.listdir(SASMODELS_DEST_IMG):
-                fromhere=os.path.join(SASMODELS_DEST_IMG,files)
-                tohere=os.path.join(SASMODELS_DEST_BUILDIMG,files)
-                shutil.copy(fromhere,tohere)
-    else:
-        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.")
+                fromhere = os.path.join(SASMODELS_DEST_IMG, files)
+                tohere = os.path.join(SASMODELS_DEST_BUILDIMG, files)
+                shutil.copy(fromhere, tohere)
+    else:
+        print("no source directory", SASMODELS_SOURCE_MODELS, "was found.")
         print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
 
