Changeset da8c5dc in sasview for check_packages.py


Ignore:
Timestamp:
Apr 4, 2014 10:48:18 AM (10 years ago)
Author:
ajj
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:
9f15df4
Parents:
d44648e
Message:

Updated check_packages.py to determine packages in use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • check_packages.py

    rb441081 rda8c5dc  
    55import sys 
    66 
    7 if sys.platform =='win32': 
    8     IS_WIN = True 
    9 else: 
    10     IS_WIN = False 
    11 try: 
    12     import setuptools 
    13     print "==> setuptools-%s installed."% setuptools.__version__ 
    14     if setuptools.__version__ != '0.6c11': 
    15         print "!!! Recommend to install 0.6c11."  
    16 except: 
    17     print "!!! setuptools-0.6c11 not installed." 
    18 try: 
    19     import pyparsing 
    20     print "==> pyparsing-%s installed."% pyparsing.__version__ 
    21     if pyparsing.__version__ != '1.5.5': 
    22         print "!!! 1.5.5 recommended." 
    23 except: 
    24     print "==> pyparsing-1.5.5 not installed." 
    25 try: 
    26     import html5lib 
    27     print "==> html5lib-%s installed."% html5lib.__version__ 
    28     if html5lib.__version__.count('0.95') > 0: 
    29         print "!!! 0.95 recommended." 
    30 except: 
    31     print "!!! html5lib-0.95 not installed." 
    32 try: 
    33     import pyPdf 
    34     print "==> pyPdf-%s installed."% pyPdf.__version__ 
    35     if pyPdf.__version__ != '1.13': 
    36         print "!!! 1.13 recommended." 
    37 except: 
    38     print "!!! pyPdf-1.13 not installed (optional)." 
    39 try: 
    40     import reportlab 
    41     print "==> reportlab-%s installed."% reportlab.__version__ 
    42     if reportlab.__version__ != '2.5': 
    43         print "!!! 2.5 recommended" 
    44 except: 
    45     print "!!! reportlab-2.5 not installed." 
    46 try: 
    47     import lxml 
    48     print "==> lxml-%s installed."% lxml.__version__ 
    49     if lxml.__version__ != '2.3': 
    50         print "!!! 2.3 recommended" 
    51 except: 
    52     print "!!! lxml-2.3 not installed." 
    53 try: 
    54     import Image 
    55     print "==> PIL-%s installed."% Image.VERSION 
    56     if Image.VERSION != '1.1.7': 
    57         print "!!! 1.1.7 recommended." 
    58 except: 
    59     print "!!! PIL-1.1.7 not installed." 
    60 try: 
    61     import pylint 
    62     print "==> pylint installed." 
    63 except: 
    64     print "!!! pylint not installed (optional)." 
    65     #os.system("START /B C:\python26\Scripts\easy_install pylint==0.25.0") 
    66 try: 
    67     import periodictable 
    68     print "==> periodictable-%s installed."% periodictable.__version__ 
    69     if periodictable.__version__ != '1.3.0': 
    70         print "!!! Recommend to install 1.3.0."  
    71 except: 
    72     print "!!! periodictable-1.3.0 is not installed." 
    73 try: 
    74     import numpy 
    75     print "==> numpy-%s installed."% numpy.__version__ 
    76     if numpy.__version__ != '1.6.1': 
    77         print "==> Recommend to install 1.6.1 (1.5.1 for MAC)."  
    78 except: 
    79     print "!!! numpy-1.6.1 not installed (1.5.1 for MAC)." 
    80 try: 
    81     import scipy 
    82     print "==> scipy-%s installed."% scipy.__version__ 
    83     if scipy.__version__ != '0.10.1': 
    84         print "!!! Recommend to install 0.10.1 (1.10.0 for MAC)."  
    85 except: 
    86     print "!!! scipy-0.10.1 not installed (1.10.0 for MAC)." 
    87 try: 
    88     import wx 
    89     print "==> wxpython-%s installed."% wx.__version__ 
    90     if wx.__version__ != '2.8.12.1': 
    91         print "!!! Recommend to install unicode-2.8.12.1."  
    92 except: 
    93     print "!!! wxpython-unicode-2.8.12.1 not installed." 
    94 try: 
    95     import matplotlib 
    96     print "==> matplotlib-%s installed."% matplotlib.__version__ 
    97     if matplotlib.__version__ != '1.1.0': 
    98         print "!!! Recommend to install 1.1.0 (1.0.1 for MAC) or higher."  
    99 except: 
    100     print "!!! matplotlib-1.1.0 not installed (1.0.1 for MAC)." 
    101 try: 
    102     from ho import pisa 
    103     if pisa.__version__ == '3.0.27': 
    104         print "==> pisa-%s installed."% pisa.__version__ 
    105     else: 
    106         print "!!! Incorrect version of pisa installed." 
    107         print "!!! 3.0.27 required." 
    108 except: 
    109     print "!!! pisa-3.0.27 not installed." 
    110 if IS_WIN: 
     7common_required_package_list = {'setuptools':{'version':'0.6c11','import_name':'setuptools','test':'__version__'}, 
     8                'pyparsing':{'version':'1.5.5','import_name':'pyparsing','test':'__version__'}, 
     9                'html5lib':{'version':'0.95','import_name':'html5lib','test':'__version__'}, 
     10                'reportlab':{'version':'2.5','import_name':'reportlab','test':'Version'}, 
     11                'lxml':{'version':'2.3','import_name':'lxml.etree','test':'LXML_VERSION'}, 
     12                'PIL':{'version':'1.1.7','import_name':'Image','test':'VERSION'}, 
     13                'pylint':{'version':None,'import_name':'pylint','test':None}, 
     14                'periodictable':{'version':'1.3.0','import_name':'periodictable','test':'__version__'}, 
     15                'numpy':{'version':'1.6.1','import_name':'numpy','test':'__version__'}, 
     16                'scipy':{'version':'0.10.1','import_name':'scipy','test':'__version__'}, 
     17                'wx':{'version':'2.8.12.1','import_name':'wx','test':'__version__'}, 
     18                'matplotlib':{'version':'1.1.0','import_name':'matplotlib','test':'__version__'}, 
     19                'pisa':{'version':'3.0.28','import_name':'ho.pisa','test':'__version__'} 
     20 
     21} 
     22win_required_package_list = {'comtypes':{'version':'0.6.2','import_name':'comtypes','test':'__version__'}, 
     23                             'pywin':{'version':'217','import_name':'pywin','test':'__version__'}, 
     24                             'py2exe':{'version':'0.6.9','import_name':'py2exe','test':'__version__'} 
     25} 
     26mac_required_package_list = {'py2app':{'version':None,'import_name':'py2app','test':'__version__'}} 
     27 
     28deprecated_package_list = {'pyPdf':{'version':'1.13','import_name':'pyPdf','test':'__version__'}} 
     29 
     30print "Checking Required Package Versions...." 
     31print 
     32print "Common Packages" 
     33for package_name,test_vals in common_required_package_list.iteritems(): 
    11134    try: 
    112         import pywin 
    113         print "==> pywin32 installed." 
     35        i = __import__(test_vals['import_name'],fromlist=['']) 
     36        if test_vals['test'] == None: 
     37            print "%s Installed (Unknown version)" % package_name 
     38        elif package_name == 'lxml': 
     39            verstring = str(getattr(i,'LXML_VERSION')) 
     40            print "%s Version Installed: %s"% (package_name,verstring.replace(', ','.').lstrip('(').rstrip(')')) 
     41        else: 
     42            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test'])) 
    11443    except: 
    115         print "!!! pywin32 not installed. Please install pywin32-217." 
     44        print '%s NOT INSTALLED'% package_name 
     45 
     46if sys.platform == 'win32': 
     47    print 
     48    print "Windows Specific Packages:" 
     49    for package_name,test_vals in win_required_package_list.iteritems(): 
     50        try: 
     51            i = __import__(test_vals['import_name'],fromlist=['']) 
     52            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test'])) 
     53        except: 
     54            print '%s NOT INSTALLED'% package_name 
     55 
     56if sys.platform == 'darwin': 
     57    print 
     58    print "MacOS Specific Packages:" 
     59    for package_name,test_vals in mac_required_package_list.iteritems(): 
     60        try: 
     61            i = __import__(test_vals['import_name'],fromlist=['']) 
     62            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test'])) 
     63        except: 
     64            print '%s NOT INSTALLED'% package_name 
     65 
     66 
     67print 
     68print "Deprecated Packages" 
     69print "You can remove these unless you need them for other reasons!" 
     70for package_name,test_vals in deprecated_package_list.iteritems(): 
    11671    try: 
    117         import py2exe 
    118         print "==> py2exe-%s installed."% py2exe.__version__ 
    119         if py2exe.__version__ != '0.6.9': 
    120             print "!!! Recommend to install 0.6.9."  
     72        i = __import__(test_vals['import_name'],fromlist=['']) 
     73        if package_name == 'pyPdf': 
     74            #pyPdf doesn't have the version number internally 
     75            print 'pyPDF Installed (Version unknown)' 
     76        else: 
     77            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test'])) 
    12178    except: 
    122         print "!!! py2exe-0.6.9 not installed. Installing..." 
    123     try: 
    124         import comtypes 
    125         print "==> comtypes-%s installed."% comtypes.__version__ 
    126         if comtypes.__version__ != '0.6.2': 
    127             print "!!! Recommend to install 0.6.2."  
    128     except: 
    129         print "!!! comtypes-0.6.2 not installed. Installing..." 
    130     print "==> Require subversion = 1.6.0 or lower version." 
    131     print "Installed:" 
    132     os.system("CALL svn --version --quiet") 
    133     print "==> Checking gcc compiler ( >= 4.2 required):" 
    134     os.system("CALL gcc -v") 
    135 else: 
    136     try: 
    137         import py2app 
    138         print "==> py2app-%s installed."% py2app.__version__ 
    139     except: 
    140         print "!!! py2app not installed (optional for MAC bundling." 
    141  
     79        print '%s NOT INSTALLED'% package_name 
Note: See TracChangeset for help on using the changeset viewer.