Index: docs/sphinx-docs/build_sphinx.py
===================================================================
--- docs/sphinx-docs/build_sphinx.py	(revision 115eb7e10c3b635f94012498785ab1e76a17614b)
+++ docs/sphinx-docs/build_sphinx.py	(revision f4d571b18c77d119dcb7f6acd0620c5afd5dce6a)
@@ -56,17 +56,17 @@
 
 #if os.path.exists(SASMODELS_SOURCE_PROLOG):
-#    print "Found models prolog folder at ", SASMODELS_SOURCE_PROLOG
+#    print "Found models prolog folder at", SASMODELS_SOURCE_PROLOG
 #if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
-#    print "Found models ref folder at ", SASMODELS_SOURCE_REF_MODELS
+#    print "Found models ref folder at", SASMODELS_SOURCE_REF_MODELS
 #if os.path.exists(SASMODELS_SOURCE_MODELS):
-#    print "Found models folder at ", SASMODELS_SOURCE_MODELS
+#    print "Found models folder at", SASMODELS_SOURCE_MODELS
 #if os.path.exists(SASMODELS_SOURCE_IMG):
-#    print "Found img folder at ", SASMODELS_SOURCE_IMG
+#    print "Found img folder at", SASMODELS_SOURCE_IMG
 #if os.path.exists(SASMODELS_DEST_REF_MODELS):
-#    print "Found models ref folder at ", SASMODELS_DEST_REF_MODELS
+#    print "Found models ref folder at", SASMODELS_DEST_REF_MODELS
 #if os.path.exists(SASMODELS_DEST_MODELS):
-#    print "Found models folder at ", SASMODELS_DEST_MODELS
+#    print "Found models folder at", SASMODELS_DEST_MODELS
 #if os.path.exists(SASMODELS_DEST_IMG):
-#    print "Found img folder at ", SASMODELS_DEST_IMG
+#    print "Found img folder at", SASMODELS_DEST_IMG
 #sys.exit()
 
@@ -107,5 +107,5 @@
     Clean the sphinx build directory.
     """
-    print "=== Cleaning Sphinx Build ==="
+    print("=== Cleaning Sphinx Build ===")
     _remove_dir(SASVIEW_DOCS)
     _remove_dir(SPHINX_BUILD)
@@ -120,7 +120,7 @@
     Copy the source toctrees to new folder for assembling the sphinx-docs
     """
-    print "=== Copying Source toctrees ==="
+    print("=== Copying Source toctrees ===")
     if os.path.exists(SASVIEW_TOC_SOURCE):
-       print "Found docs folder at ", SASVIEW_TOC_SOURCE
+       print("Found docs folder at", SASVIEW_TOC_SOURCE)
        shutil.copytree(SASVIEW_TOC_SOURCE, SPHINX_SOURCE)
 
@@ -141,5 +141,5 @@
     so that Sphinx may pick it up when generating the documentation.
     """
-    print "=== Retrieve User Docs ==="
+    print("=== Retrieve User Docs ===")
 
     # Copy documentation files from their "source" to their "destination".
@@ -148,5 +148,5 @@
 
             docs = os.path.abspath(os.path.join(root, dirname))
-            print "Found docs folder at \"%s\"." % docs
+            print("Found docs folder at \"%s\"." % docs)
 
             dest_dir_part = os.path.dirname(os.path.relpath(docs, SASVIEW_SRC))
@@ -158,47 +158,48 @@
 
     # Now pickup testdata_help.rst
-#    print os.path.abspath(SASVIEW_TEST)
-#    print os.path.abspath(SPHINX_SOURCE_TEST)
-    print "=== Including Test Data Docs ==="
+    print("=== Including Test Data Docs ===")
     if os.path.exists(SASVIEW_TEST):
-       print "Found docs folder at ", SASVIEW_TEST
+       print("Found docs folder at", SASVIEW_TEST)
        shutil.copytree(SASVIEW_TEST, SPHINX_SOURCE_TEST)
 
-    print "=== And the Sasmodels Docs ==="
+    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)
     if os.path.exists(SASMODELS_SOURCE_IMG):
-        print "Found img  folder SASMODELS_SOURCE_IMG    at ", SASMODELS_SOURCE_IMG
+        print("Found img folder SASMODELS_SOURCE_IMG at", SASMODELS_SOURCE_IMG)
         if not os.path.exists(SASMODELS_DEST_IMG):
-            print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG
+            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
             os.makedirs(SASMODELS_DEST_IMG)
-            print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG
-        else: print "Found img  folder SASMODELS_DEST_IMG      at ", SASMODELS_DEST_IMG
-        print "Copying sasmodels model image files..."
+            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
+        else:
+            print("Found img folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
+        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 "cannot find SASMODELS_SOURCE_IMG", SASMODELS_SOURCE_IMG
+    else:
+        print("no source directory",SASMODELS_SOURCE_IMG,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_AUTOIMG):
-        print "Found img  folder SASMODELS_SOURCE_AUTOIMG    at ", SASMODELS_SOURCE_AUTOIMG
+        print("Found img folder SASMODELS_SOURCE_AUTOIMG at", SASMODELS_SOURCE_AUTOIMG)
         if not os.path.exists(SASMODELS_DEST_IMG):
-            print "Missing docs folder SASMODELS_DEST_IMG at ", SASMODELS_DEST_IMG
+            print("Missing docs folder SASMODELS_DEST_IMG at", SASMODELS_DEST_IMG)
             os.makedirs(SASMODELS_DEST_BUILDIMG)
-            print "created SASMODELS_DEST_BUILDIMG at ", SASMODELS_DEST_BUILDIMG
-        print "Copying sasmodels model auto-generated image files..."
+            print("created SASMODELS_DEST_BUILDIMG at", SASMODELS_DEST_BUILDIMG)
+        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"
+    else:
+        print("no source directory",SASMODELS_SOURCE_AUTOIMG ,"was found")
 
     # And the rst prolog with the unit substitutions
     if os.path.exists(SASMODELS_SOURCE_PROLOG):
-        print "Found prolog folder SASMODELS_SOURCE_PROLOG at ", SASMODELS_SOURCE_PROLOG
+        print("Found prolog folder SASMODELS_SOURCE_PROLOG at", SASMODELS_SOURCE_PROLOG)
         if os.path.exists(SASMODELS_DEST_PROLOG):
-            print "Found docs folder SASMODELS_DEST_PROLOG   at ", SASMODELS_DEST_PROLOG
-            print "Copying sasmodels rst_prolog file..."
+            print("Found docs folder SASMODELS_DEST_PROLOG at", SASMODELS_DEST_PROLOG)
+            print("Copying sasmodels rst_prolog file...")
             for files in os.listdir(SASMODELS_SOURCE_PROLOG):
                 if files.startswith("rst"):
@@ -206,11 +207,12 @@
                     tohere=os.path.join(SASMODELS_DEST_PROLOG,files)
                     shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_PROLOG, "was found"
+    else:
+        print "no source directory",SASMODELS_SOURCE_PROLOG, "was found"
 
     if os.path.exists(SASMODELS_SOURCE_GPU):
-        print "Found docs folder SASMODELS_SOURCE_GPU at ", SASMODELS_SOURCE_GPU
+        print("Found docs folder SASMODELS_SOURCE_GPU at", SASMODELS_SOURCE_GPU)
         if os.path.exists(SPHINX_SOURCE_USER):
-            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER
-            print "Copying sasmodels gpu files..."
+            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
+            print("Copying sasmodels gpu files...")
             for files in os.listdir(SASMODELS_SOURCE_GPU):
                 if files.endswith(".rst"):
@@ -218,11 +220,12 @@
                     tohere=os.path.join(SPHINX_SOURCE_USER,files)
                     shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_GPU," was found"
+    else:
+        print "no source directory",SASMODELS_SOURCE_GPU,"was found"
 
     if os.path.exists(SASMODELS_SOURCE_SESANS):
-        print "Found docs folder SASMODELS_SOURCE_SESANS at ", SASMODELS_SOURCE_SESANS
+        print("Found docs folder SASMODELS_SOURCE_SESANS at", SASMODELS_SOURCE_SESANS)
         if os.path.exists(SPHINX_SOURCE_USER):
-            print "Found docs folder SPHINX_SOURCE_USER      at ", SPHINX_SOURCE_USER
-            print "Copying sasmodels sesans files..."
+            print("Found docs folder SPHINX_SOURCE_USER at", SPHINX_SOURCE_USER)
+            print("Copying sasmodels sesans files...")
             for files in os.listdir(SASMODELS_SOURCE_SESANS):
                 if files.endswith(".rst"):
@@ -230,11 +233,12 @@
                     tohere=os.path.join(SPHINX_SOURCE_USER,files)
                     shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_SESANS," was found"
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANS,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGNETISM):
-        print "Found docs folder SASMODELS_SOURCE_MAGNETISM at ", SASMODELS_SOURCE_MAGNETISM
+        print("Found docs folder SASMODELS_SOURCE_MAGNETISM at", SASMODELS_SOURCE_MAGNETISM)
         if os.path.exists(SASMODELS_DEST_REF_MODELS):
-            print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS
-            print "Copying sasmodels model toctree files..."
+            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
+            print("Copying sasmodels model toctree files...")
             for files in os.listdir(SASMODELS_SOURCE_MAGNETISM):
                 if files.endswith(".rst"):
@@ -242,37 +246,40 @@
                     tohere=os.path.join(SASMODELS_DEST_REF_MODELS,files)
                     shutil.copy(fromhere,tohere)
-    else: print "no source directory",SASMODELS_SOURCE_MAGNETISM," was found"
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGNETISM,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_MAGIMG):
-        print "Found img folder SASMODELS_SOURCE_MAGIMG   at ", SASMODELS_SOURCE_MAGIMG
+        print("Found img folder SASMODELS_SOURCE_MAGIMG   at", SASMODELS_SOURCE_MAGIMG)
         if not os.path.exists(SASMODELS_DEST_MAGIMG):
-            print "Missing img folder SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG
+            print("Missing img folder SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
             os.makedirs(SASMODELS_DEST_MAGIMG)
-            print "created SASMODELS_DEST_MAGIMG at ", SASMODELS_DEST_MAGIMG
-        print "Copying sasmodels mag image files..."
+            print("created SASMODELS_DEST_MAGIMG at", SASMODELS_DEST_MAGIMG)
+        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"
+    else:
+        print("no source directory",SASMODELS_SOURCE_MAGIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_SESANSIMG):
-        print "Found img folder SASMODELS_SOURCE_SESANSIMG   at ", SASMODELS_SOURCE_SESANSIMG
+        print("Found img folder SASMODELS_SOURCE_SESANSIMG at", SASMODELS_SOURCE_SESANSIMG)
         if not os.path.exists(SASMODELS_DEST_SESANSIMG):
-            print "Missing img folder SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG
+            print("Missing img folder SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
             os.makedirs(SASMODELS_DEST_SESANSIMG)
-            print "created SASMODELS_DEST_SESANSIMG at ", SASMODELS_DEST_SESANSIMG
-        print "Copying sasmodels sesans image files..."
+            print("created SASMODELS_DEST_SESANSIMG at", SASMODELS_DEST_SESANSIMG)
+        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"
+    else:
+        print("no source directory",SASMODELS_SOURCE_SESANSIMG ,"was found")
 
     if os.path.exists(SASMODELS_SOURCE_REF_MODELS):
-        print "Found docs folder SASMODELS_SOURCE_REF_MODELS at ", SASMODELS_SOURCE_REF_MODELS
+        print("Found docs folder SASMODELS_SOURCE_REF_MODELS at", SASMODELS_SOURCE_REF_MODELS)
         if os.path.exists(SASMODELS_DEST_REF_MODELS):
-            print "Found docs folder SASMODELS_DEST_REF_MODELS   at ", SASMODELS_DEST_REF_MODELS
-            print "Copying sasmodels model toctree files..."
+            print("Found docs folder SASMODELS_DEST_REF_MODELS at", SASMODELS_DEST_REF_MODELS)
+            print("Copying sasmodels model toctree files...")
             for files in os.listdir(SASMODELS_SOURCE_REF_MODELS):
                 if files.endswith(".rst"):
@@ -284,22 +291,23 @@
         #        print files
                 if files.startswith("shape"):
-                    print "Changing toc paths in", files
+                    print("Changing toc paths in", files)
                     inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("sphere"):
-                    print "Changing toc paths in", files
+                    print("Changing toc paths in", files)
                     inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("custom"):
-                    print "Changing toc paths in", files
+                    print("Changing toc paths in", files)
                     inplace_change(os.path.join(SASMODELS_DEST_REF_MODELS,files), "../../model/", "models/")
                 if files.startswith("structure"):
-                    print "Changing toc paths in", files
+                    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"
+    else:
+        print("no source directory",SASMODELS_SOURCE_REF_MODELS," was found")
 
     if os.path.exists(SASMODELS_SOURCE_MODELS):
-        print "Found docs folder SASMODELS_SOURCE_MODELS at ", SASMODELS_SOURCE_MODELS
+        print("Found docs folder SASMODELS_SOURCE_MODELS at", SASMODELS_SOURCE_MODELS)
         if os.path.exists(SASMODELS_DEST_MODELS):
-            print "Found docs folder SASMODELS_DEST_MODELS   at ", SASMODELS_DEST_MODELS
-            print "Copying sasmodels model files..."
+            print("Found docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
+            print("Copying sasmodels model files...")
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
@@ -308,10 +316,10 @@
                     shutil.copy(fromhere,tohere)
         else:
-            print "Missing docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS
+            print("Missing docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
             os.makedirs(SASMODELS_DEST_MODELS)
             if not os.path.exists(SASMODELS_DEST_BUILDIMG):
                 os.makedirs(SASMODELS_DEST_BUILDIMG)
-            print "Created docs folder SASMODELS_DEST_MODELS at ", SASMODELS_DEST_MODELS
-            print "Copying model files for build..."
+            print("Created docs folder SASMODELS_DEST_MODELS at", SASMODELS_DEST_MODELS)
+            print("Copying model files for build...")
             for files in os.listdir(SASMODELS_SOURCE_MODELS):
                 if files.endswith(".rst"):
@@ -320,10 +328,12 @@
                     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..."
+            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.\n !!!!NO MODEL DOCS WILL BE BUILT!!!!"
+    else:
+        print("no source directory",SASMODELS_SOURCE_MODELS,"was found.")
+        print("!!!!NO MODEL DOCS WILL BE BUILT!!!!")
 
 
@@ -333,13 +343,13 @@
     """
     if os.path.exists(BUMPS_DOCS):
-        print "=== Retrieve BUMPS Docs ==="
+        print("=== Retrieve BUMPS Docs ===")
         filenames = [os.path.join(BUMPS_DOCS, "optimizer.rst")]
         filenames += glob(os.path.join(BUMPS_DOCS, "dream-*.png"))
         filenames += glob(os.path.join(BUMPS_DOCS, "fit-*.png"))
         for f in filenames:
-            print "Copying file", f
+            print("Copying file", f)
             shutil.copy(f, BUMPS_TARGET)
     else:
-        print """
+        print("""
 *** Error *** missing directory %s
 The documentation will not include the optimizer selection section.
@@ -347,5 +357,5 @@
 
 
-""" % BUMPS_DOCS
+""" % BUMPS_DOCS)
 
 def apidoc():
@@ -354,5 +364,5 @@
     in the SasView build directory.
     """
-    print "=== Generate API Rest Files ==="
+    print("=== Generate API Rest Files ===")
 
     # Clean directory before generating a new version.
@@ -368,5 +378,5 @@
     Runs sphinx-build.  Reads in all .rst files and spits out the final html.
     """
-    print "=== Build HTML Docs from Rest Files ==="
+    print("=== Build HTML Docs from Rest Files ===")
     subprocess.call(["sphinx-build",
                      "-b", "html", # Builder name. TODO: accept as arg to setup.py.
@@ -375,5 +385,5 @@
                      os.path.join(SPHINX_BUILD, "html")])
 
-    print "=== Copy HTML Docs to Build Directory ==="
+    print("=== Copy HTML Docs to Build Directory ===")
     html = os.path.join(SPHINX_BUILD, "html")
     copy_tree(html, SASVIEW_DOCS)
@@ -387,5 +397,5 @@
     build()
 
-    print "=== Done ==="
+    print("=== Done ===")
 
 if __name__ == "__main__":
