Index: sansview/build_sansview.py
===================================================================
--- sansview/build_sansview.py	(revision 6e2fe95c799213707cc239d2f30cbe2fb1b5a99a)
+++ sansview/build_sansview.py	(revision 7b35808359aaedf62b4d8302bd57a8fa3e08fbb6)
@@ -25,5 +25,17 @@
 import os
 import shutil
-
+import logging
+
+# Installation folder
+import time
+timestamp = int(time.time())
+INSTALL_FOLDER = "install_%s" % str(timestamp)
+
+logging.basicConfig(level=logging.INFO,
+                    format='%(asctime)s %(levelname)s %(message)s',
+                    filename='build_%s.log' % str(timestamp),
+                    filemode='w')
+
+CWD    = os.getcwd()
 PYTHON = "c:\python25\python"
 SVN    = "svn"
@@ -41,4 +53,5 @@
 PARK_INTEG = "0.1.0"
 
+# URLs for SVN repos
 SANSMODELS_URL = "svn://danse.us/sans/releases/sansmodels-%s" % SANSMODELS
 DATALOADER_URL = "svn://danse.us/sans/releases/DataLoader-%s" % DATALOADER
@@ -52,9 +65,4 @@
 PARK_URL = "svn://danse.us/park/branches/park-1.2"
 
-# Installation folder
-import time
-timestamp = int(time.time())
-INSTALL_FOLDER = "install_%s" % str(timestamp)
-
 
 def check_system():
@@ -65,23 +73,23 @@
         import wx
     except:
-        print "wxpython missing"
+        logging.error("wxpython missing")
     
     try:
         import matplotlib
     except:
-        print "matplotlib missing"
+        logging.error("matplotlib missing")
         
     try:
         import numpy
     except:
-        print "numpy missing"
+        logging.error("numpy missing")
         
     try:
         import scipy
     except:
-        print "scipy missing"
+        logging.error("scipy missing")
         
     if os.system("gcc -dumpversion")==1:
-         print "missing mingw"
+        logging.error("missing mingw")
 
 def install_pkg(install_dir, setup_dir, url):
@@ -98,6 +106,6 @@
     os.system("%s checkout -q %s" % (SVN, url))        
     os.chdir(setup_dir)
-    os.system("%s setup.py build -cmingw32" % PYTHON)
-    os.system("%s setup.py install" % PYTHON)
+    os.system("%s setup.py -q build -cmingw32" % PYTHON)
+    os.system("%s setup.py -q install" % PYTHON)
     
 def checkout(release=False):
@@ -158,11 +166,27 @@
     os.chdir(wd)
     if release:
-        os.system("%s checkout %s" % (SVN, SANSVIEW_URL))
-    else:
-        os.system("%s checkout svn://danse.us/sans/trunk/sansview" % SVN)
+        os.system("%s checkout -q %s" % (SVN, SANSVIEW_URL))
+    else:
+        os.system("%s checkout -q svn://danse.us/sans/trunk/sansview" % SVN)
     
 def prepare():
+    """
+        Prepare the build
+    """
+    # Remove existing libraries
+    from distutils.sysconfig import get_python_lib
+    libdir = get_python_lib()
+    old_dirs = [os.path.join(libdir, 'danse'),
+                os.path.join(libdir, 'data_util'),
+                os.path.join(libdir, 'DataLoader'),
+                os.path.join(libdir, 'park'),
+                os.path.join(libdir, 'sans'),
+                os.path.join(libdir, 'sans_extension'),
+                ]
+    for d in old_dirs:
+        if os.path.isdir(d):
+            shutil.rmtree(d)
+    
     # Create a fresh installation folder
-    
     if os.path.isdir(INSTALL_FOLDER):
         shutil.rmtree(INSTALL_FOLDER)
@@ -208,4 +232,5 @@
             print PARK_URL 
         else:
+            logging.info("Build script for SansView %s" % SANSVIEW)
             # Prepare installation folder
             prepare()
@@ -213,15 +238,18 @@
             # Check the command line argument
             if sys.argv[1]=="-t":
-                print "Building trunk version"
+                logging.info("Building trunk version")
                 checkout()
             elif sys.argv[1]=="-r":
-                print "Building release version"
+                logging.info("Building release version")
                 checkout(True)
             elif sys.argv[1]=="-i":
-                print "Building release version"
+                logging.info("Building release version")
                 checkout(True)
-                print "Building installer from release version"
+                logging.info("Building installer from release version")
                 os.chdir("sansview-%s" % (SANSVIEW))
-                os.system("%s setup_exe.py py2exe" % PYTHON)
-                os.system("%s installer.iss" % INNO)
-    
+                os.system("%s setup_exe.py -q py2exe" % PYTHON)
+                os.system("%s/Q installer.iss" % INNO)
+                shutil.copy2(os.path.join("Output","setupSansView.exe"), 
+                             os.path.join(CWD, "setupSansView_%s.exe" % str(timestamp)))
+                
+    
