Changeset df83aa4 in sasview for sansview/setup_all.py


Ignore:
Timestamp:
Sep 14, 2011 12:53:25 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
6a7cf2c
Parents:
296b9c1
Message:

simplified the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/setup_all.py

    r6367ec5 rdf83aa4  
    2424 
    2525 
    26 # Release version 1.9 
    27 SANSMODELS = "0.9.1" 
    28 DATALOADER = "0.9" 
    29 GUIFRAME   = "0.9.1" 
    30 SANSVIEW   = "1.9.1" 
    31 PLOTTOOLS  = "0.9.1" 
    32 UTIL       = "0.9.1" 
    33 PARK       = "1.2.1" 
    34 PARK_INTEG = "0.9.1" 
    35 PRVIEW     = "0.9.1" 
    36 PR_INV     = "0.9" 
    37 CALCULATOR = "0.9.1" 
    38 CALC_VIEW  = "0.9" 
    39 INVARIANT  = "0.9.1" 
    40 INV_VIEW   = "0.9" 
    41 FIT_VIEW   = "0.9.1" 
    42  
    43  
    4426def check_system(): 
    4527    """ 
     
    4729    """ 
    4830    is_ok = True 
     31    msg = '' 
    4932    try: 
    5033        import wx 
    5134        if not wx.__version__.count('2.8.11') and \ 
    5235             not wx.__version__.count('2.8.12'): 
    53             print "wx: Recommending version 2.8.11 or 2.8.12" 
    54     except: 
    55         is_ok = False 
    56         print "Error: wxpython 2.8.11 (12) missing" 
     36            mesg = "wx: Recommending version 2.8.11 or 2.8.12" 
     37            msg += mesg + "\n" 
     38            print mesg 
     39    except: 
     40        is_ok = False 
     41        mesg = "Error: wxpython 2.8.11 (12) missing" 
     42        msg += mesg + "\n" 
     43        print mesg 
    5744        logging.error("wxpython missing") 
    5845     
     
    6148        if not matplotlib.__version__.count('0.99.0') and \ 
    6249             not matplotlib.__version__.count('0.99.1'): 
    63             print "matplotlib: Recommending version 0.99.0 or 0.99.1" 
    64     except: 
    65         is_ok = False 
    66         print "Error: matplotlib 0.99.0 (1) missing" 
     50            mesg = "matplotlib: Recommending version 0.99.0 or 0.99.1" 
     51            msg += mesg + "\n" 
     52            print mesg 
     53    except: 
     54        is_ok = False 
     55        mesg = "Error: matplotlib 0.99.0 (1) missing" 
     56        msg += mesg + "\n" 
     57        print mesg 
    6758        logging.error("matplotlib missing") 
    6859         
     
    7061        import numpy  
    7162        if not numpy.__version__.count('1.4.1'): 
    72             print "numpy: Recommending version 1.4.1" 
    73     except: 
    74         is_ok = False 
    75         print "Error: numpy 1.4.1 missing" 
     63            mesg = "numpy: Recommending version 1.4.1" 
     64            msg += mesg + "\n" 
     65            print mesg 
     66    except: 
     67        is_ok = False 
     68        mesg = "Error: numpy 1.4.1 missing" 
     69        msg += mesg + "\n" 
     70        print mesg 
    7671        logging.error("numpy missing") 
    7772         
     
    7974        import scipy  
    8075        if not scipy.__version__.count('0.7.2'): 
    81             print "scipy: Recommending version 0.7.2" 
    82     except: 
    83         is_ok = False 
    84         print "Error: scipy 0.7.2 missing" 
     76            mesg = "scipy: Recommending version 0.7.2" 
     77            msg += mesg + "\n" 
     78            print mesg 
     79    except: 
     80        is_ok = False 
     81        mesg = "Error: scipy 0.7.2 missing" 
     82        msg += mesg + "\n" 
     83        print mesg 
    8584        logging.error("scipy missing") 
    8685 
     
    8887        import periodictable 
    8988        if not periodictable.__version__.count('1.3.0'): 
    90             print "periodictable: Recommending version 1.3.0" 
     89            mesg = "periodictable: Recommending version 1.3.0" 
     90            msg += mesg + "\n" 
     91            print mesg 
    9192    except: 
    9293        print "Trying to install perodic table..." 
     
    9697        except: 
    9798            is_ok = False 
     99            mesg = "Error: periodictable missing" 
     100            msg += mesg + "\n" 
    98101            print "easy_install periodictable failed" 
    99102            logging.error("periodictable missing") 
     
    105108    except: 
    106109        is_ok = False 
    107         print "comtypes missing" 
     110        mesg = "comtypes missing" 
     111        msg += mesg + "\n" 
     112        print mesg 
    108113        logging.error("comtypes missing") 
    109114         
     
    113118    except: 
    114119        is_ok = False 
    115         print "pywin32 missing" 
     120        mesg = "pywin32 missing" 
     121        msg += mesg + "\n" 
     122        print mesg 
    116123        logging.error("pywin32 missing") 
    117124             
     
    124131        except: 
    125132            is_ok = False 
     133            mesg = "pyparsing missing" 
     134            msg += mesg + "\n" 
     135            print mesg 
    126136            print "easy_install pyparsing failed" 
    127137            logging.error("pyparsing missing") 
     
    129139    if os.system("gcc -dumpversion")==1: 
    130140        is_ok = False 
    131         logging.error("missing mingw") 
    132      
    133     return is_ok 
     141        mesg = "missing mingw/gcc" 
     142        msg += mesg + "\n" 
     143        print mesg 
     144        logging.error("missing mingw/gcc") 
     145     
     146    return is_ok, msg 
    134147 
    135148 
     
    146159    try:    
    147160        os.chdir(setup_dir)  
    148         os.system("%s setup.py install" % PYTHON)     
    149     except: 
    150         logging.error("Install failed on %s"% setup_dir) 
     161        os.system("%s setup.py install" % PYTHON)   
     162        print "Installation %s successful.." % setup_dir   
     163    except: 
     164        logging.error("Installation failed on %s"% setup_dir) 
    151165        logging.error(sys.exc_value) 
    152166        raw_input("Press enter to continue\n") 
     
    159173    wd = os.getcwd() 
    160174    os.chdir(wd) 
    161      
    162     if release: 
    163         install_pkg("sansdataloader-%s" % DATALOADER) 
    164     else: 
    165         install_pkg("sansdataloader") 
    166      
    167     os.chdir(wd) 
    168     if release: 
    169         install_pkg("sansmodels-%s" % SANSMODELS) 
    170     else: 
    171         install_pkg("sansmodels") 
    172      
    173     os.chdir(wd) 
    174     if release: 
    175         install_pkg("sansguiframe-%s" % GUIFRAME) 
    176     else: 
    177         install_pkg("sansguiframe") 
    178      
    179     os.chdir(wd) 
    180     if release: 
    181         install_pkg("plottools-%s" % PLOTTOOLS) 
    182     else: 
    183         install_pkg("plottools") 
    184      
    185     os.chdir(wd) 
    186     if release: 
    187         install_pkg("util-%s" % UTIL) 
    188     else: 
    189         install_pkg("util") 
    190      
    191     os.chdir(wd) 
    192     if release: 
    193         install_pkg("park_integration-%s" % PARK_INTEG) 
    194     else: 
    195         install_pkg("park_integration") 
    196      
    197     os.chdir(wd) 
    198     if release: 
    199         install_pkg("inversionview-%s" % PRVIEW) 
    200     else: 
    201         install_pkg("inversionview") 
    202      
    203     os.chdir(wd) 
    204     if release: 
    205         install_pkg("pr_inversion-%s" % PR_INV) 
    206     else: 
    207         install_pkg("pr_inversion") 
    208      
    209     os.chdir(wd) 
    210     if release: 
    211         install_pkg("sansinvariant-%s" % INVARIANT) 
    212     else: 
    213         install_pkg("sansinvariant") 
    214      
    215     os.chdir(wd) 
    216     if release: 
    217         install_pkg("invariantview-%s" % INV_VIEW) 
    218     else: 
    219         install_pkg("invariantview") 
    220      
    221     os.chdir(wd) 
    222     if release: 
    223         install_pkg("calculatorview-%s" % CALC_VIEW) 
    224     else: 
    225         install_pkg("calculatorview") 
    226      
    227     os.chdir(wd) 
    228     if release: 
    229         install_pkg("sanscalculator-%s" % CALCULATOR) 
    230     else: 
    231         install_pkg("sanscalculator") 
    232  
    233  
    234     os.chdir(wd) 
    235     if release: 
    236         install_pkg("park-%s" % PARK) 
    237     else: 
    238         install_pkg("park-1.2") 
    239          
    240     os.chdir(wd) 
    241     if release: 
    242         install_pkg("fittingview-%s" % FIT_VIEW) 
    243     else: 
    244         install_pkg("fittingview") 
    245              
    246     os.chdir(wd) 
    247     if release: 
    248         setup_dir = "sansview-%s" % SANSVIEW 
    249     else: 
    250         setup_dir = "sansview"  
     175    for folder in os.listdir(wd): 
     176        if os.path.isdir(os.path.join(wd, folder)): 
     177            if folder.count('sansview') > 0: 
     178                setup_dir = folder 
     179            try: 
     180                install_pkg(folder) 
     181            except: 
     182                pass 
     183        os.chdir(wd) 
     184 
    251185         
    252186    # run sansview 
     
    290224if __name__ == "__main__":  
    291225     
    292     if check_system():     
     226    is_ok, _msg = check_system() 
     227    if is_ok:     
    293228        if len(sys.argv)==1: 
    294229            # If there is no argument, build the installer 
     
    305240                print "    -t: Builds SansView from the trunk"        
    306241 
    307             elif sys.argv[1]=="-n": 
    308                 # Print out release URLs 
    309                 print SANSMODELS_URL  
    310                 print DATALOADER_URL  
    311                 print GUIFRAME_URL  
    312                 print PLOTTOOLS_URL  
    313                 print UTIL_URL  
    314                 print SANSVIEW_URL 
    315                 print PARK_INTEG_URL  
    316                 print PARK_URL  
    317                 print PRVIEW  
    318                 print PR_INV  
    319                 print FIT_URL 
    320242            else: 
    321                 logging.info("Build script for SansView %s" % SANSVIEW) 
     243                logging.info("Build script for SansView") 
    322244                print "Warning: This script will delete the previous SansView packages..." 
    323245                prepare() 
     
    331253    
    332254     
    333  
     255        print _msg 
    334256        raw_input("Press enter to continue\n") 
    335257     
    336258    else: 
     259        print _msg 
    337260        raw_input("Press enter and install the missing packages before re-run this scripts.\n") 
Note: See TracChangeset for help on using the changeset viewer.