Changeset 7b35808 in sasview


Ignore:
Timestamp:
Apr 14, 2009 5:25:58 PM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
69bee6d
Parents:
ac166e9c
Message:

sansview: build script: logging facility, clean up before install, copy of final installer to desktop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/build_sansview.py

    r6e2fe95 r7b35808  
    2525import os 
    2626import shutil 
    27  
     27import logging 
     28 
     29# Installation folder 
     30import time 
     31timestamp = int(time.time()) 
     32INSTALL_FOLDER = "install_%s" % str(timestamp) 
     33 
     34logging.basicConfig(level=logging.INFO, 
     35                    format='%(asctime)s %(levelname)s %(message)s', 
     36                    filename='build_%s.log' % str(timestamp), 
     37                    filemode='w') 
     38 
     39CWD    = os.getcwd() 
    2840PYTHON = "c:\python25\python" 
    2941SVN    = "svn" 
     
    4153PARK_INTEG = "0.1.0" 
    4254 
     55# URLs for SVN repos 
    4356SANSMODELS_URL = "svn://danse.us/sans/releases/sansmodels-%s" % SANSMODELS 
    4457DATALOADER_URL = "svn://danse.us/sans/releases/DataLoader-%s" % DATALOADER 
     
    5265PARK_URL = "svn://danse.us/park/branches/park-1.2" 
    5366 
    54 # Installation folder 
    55 import time 
    56 timestamp = int(time.time()) 
    57 INSTALL_FOLDER = "install_%s" % str(timestamp) 
    58  
    5967 
    6068def check_system(): 
     
    6573        import wx 
    6674    except: 
    67         print "wxpython missing" 
     75        logging.error("wxpython missing") 
    6876     
    6977    try: 
    7078        import matplotlib 
    7179    except: 
    72         print "matplotlib missing" 
     80        logging.error("matplotlib missing") 
    7381         
    7482    try: 
    7583        import numpy 
    7684    except: 
    77         print "numpy missing" 
     85        logging.error("numpy missing") 
    7886         
    7987    try: 
    8088        import scipy 
    8189    except: 
    82         print "scipy missing" 
     90        logging.error("scipy missing") 
    8391         
    8492    if os.system("gcc -dumpversion")==1: 
    85          print "missing mingw" 
     93        logging.error("missing mingw") 
    8694 
    8795def install_pkg(install_dir, setup_dir, url): 
     
    98106    os.system("%s checkout -q %s" % (SVN, url))         
    99107    os.chdir(setup_dir) 
    100     os.system("%s setup.py build -cmingw32" % PYTHON) 
    101     os.system("%s setup.py install" % PYTHON) 
     108    os.system("%s setup.py -q build -cmingw32" % PYTHON) 
     109    os.system("%s setup.py -q install" % PYTHON) 
    102110     
    103111def checkout(release=False): 
     
    158166    os.chdir(wd) 
    159167    if release: 
    160         os.system("%s checkout %s" % (SVN, SANSVIEW_URL)) 
    161     else: 
    162         os.system("%s checkout svn://danse.us/sans/trunk/sansview" % SVN) 
     168        os.system("%s checkout -q %s" % (SVN, SANSVIEW_URL)) 
     169    else: 
     170        os.system("%s checkout -q svn://danse.us/sans/trunk/sansview" % SVN) 
    163171     
    164172def prepare(): 
     173    """ 
     174        Prepare the build 
     175    """ 
     176    # Remove existing libraries 
     177    from distutils.sysconfig import get_python_lib 
     178    libdir = get_python_lib() 
     179    old_dirs = [os.path.join(libdir, 'danse'), 
     180                os.path.join(libdir, 'data_util'), 
     181                os.path.join(libdir, 'DataLoader'), 
     182                os.path.join(libdir, 'park'), 
     183                os.path.join(libdir, 'sans'), 
     184                os.path.join(libdir, 'sans_extension'), 
     185                ] 
     186    for d in old_dirs: 
     187        if os.path.isdir(d): 
     188            shutil.rmtree(d) 
     189     
    165190    # Create a fresh installation folder 
    166      
    167191    if os.path.isdir(INSTALL_FOLDER): 
    168192        shutil.rmtree(INSTALL_FOLDER) 
     
    208232            print PARK_URL  
    209233        else: 
     234            logging.info("Build script for SansView %s" % SANSVIEW) 
    210235            # Prepare installation folder 
    211236            prepare() 
     
    213238            # Check the command line argument 
    214239            if sys.argv[1]=="-t": 
    215                 print "Building trunk version" 
     240                logging.info("Building trunk version") 
    216241                checkout() 
    217242            elif sys.argv[1]=="-r": 
    218                 print "Building release version" 
     243                logging.info("Building release version") 
    219244                checkout(True) 
    220245            elif sys.argv[1]=="-i": 
    221                 print "Building release version" 
     246                logging.info("Building release version") 
    222247                checkout(True) 
    223                 print "Building installer from release version" 
     248                logging.info("Building installer from release version") 
    224249                os.chdir("sansview-%s" % (SANSVIEW)) 
    225                 os.system("%s setup_exe.py py2exe" % PYTHON) 
    226                 os.system("%s installer.iss" % INNO) 
    227      
     250                os.system("%s setup_exe.py -q py2exe" % PYTHON) 
     251                os.system("%s/Q installer.iss" % INNO) 
     252                shutil.copy2(os.path.join("Output","setupSansView.exe"),  
     253                             os.path.join(CWD, "setupSansView_%s.exe" % str(timestamp))) 
     254                 
     255     
Note: See TracChangeset for help on using the changeset viewer.