source: sasview/check_packages.py @ 3c3a440

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 3c3a440 was 61c93b3, checked in by Mathieu Doucet <doucetm@…>, 10 years ago

Updated requirements

  • Property mode set to 100644
File size: 4.3 KB
Line 
1"""
2Checking and reinstalling the external packages
3"""
4import os
5import sys
6
7# Fix for error: hash-collision-3-both-1-and-1/
8# See http://jaredforsyth.com/blog/2010/apr/28/accessinit-hash-collision-3-both-1-and-1/
9import PIL.Image
10sys.modules['Image'] = PIL.Image
11
12common_required_package_list = {
13    'setuptools':{'version':'0.6c11','import_name':'setuptools','test':'__version__'},
14    'pyparsing':{'version':'1.5.5','import_name':'pyparsing','test':'__version__'},
15    'html5lib':{'version':'0.95','import_name':'html5lib','test':'__version__'},
16    'reportlab':{'version':'2.5','import_name':'reportlab','test':'Version'},
17    'lxml':{'version':'2.3','import_name':'lxml.etree','test':'LXML_VERSION'},
18    'PIL':{'version':'1.1.7','import_name':'Image','test':'VERSION'},
19    'pylint':{'version':None,'import_name':'pylint','test':None},
20    'periodictable':{'version':'1.3.0','import_name':'periodictable','test':'__version__'},
21    'bumps':{'version':'0.7.5.4','import_name':'bumps','test':'__version__'},
22    'numpy':{'version':'1.6.1','import_name':'numpy','test':'__version__'},
23    'scipy':{'version':'0.10.1','import_name':'scipy','test':'__version__'},
24    'wx':{'version':'2.8.12.1','import_name':'wx','test':'__version__'},
25    'matplotlib':{'version':'1.1.0','import_name':'matplotlib','test':'__version__'},
26    'xhtml2pdf':{'version':'3.0.33','import_name':'xhtml2pdf','test':'__version__'},
27    'sphinx':{'version':'1.2.1','import_name':'sphinx','test':'__version__'},
28    'unittest-xml-reporting':{'version':'1.10.0','import_name':'xmlrunner','test':'__version__'},
29}
30win_required_package_list = {
31    'comtypes':{'version':'0.6.2','import_name':'comtypes','test':'__version__'},
32    'pywin':{'version':'217','import_name':'pywin','test':'__version__'},
33    'py2exe':{'version':'0.6.9','import_name':'py2exe','test':'__version__'},
34}
35mac_required_package_list = {
36    'py2app':{'version':None,'import_name':'py2app','test':'__version__'},
37}
38
39deprecated_package_list = {
40    'pyPdf':{'version':'1.13','import_name':'pyPdf','test':'__version__'},
41}
42
43print "Checking Required Package Versions...."
44print
45print "Common Packages"
46for package_name,test_vals in common_required_package_list.iteritems():
47    try:
48        i = __import__(test_vals['import_name'],fromlist=[''])
49        if test_vals['test'] == None:
50            print "%s Installed (Unknown version)" % package_name
51        elif package_name == 'lxml':
52            verstring = str(getattr(i,'LXML_VERSION'))
53            print "%s Version Installed: %s"% (package_name,verstring.replace(', ','.').lstrip('(').rstrip(')'))
54        else:
55            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
56    except:
57        print '%s NOT INSTALLED'% package_name
58
59if sys.platform == 'win32':
60    print
61    print "Windows Specific Packages:"
62    for package_name,test_vals in win_required_package_list.iteritems():
63        try:
64            if package_name == "pywin":
65                import win32api
66                fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__,'\\')
67                print "%s Version Installed: %s"% (package_name,fixed_file_info['FileVersionLS'] >> 16)
68            else:
69                i = __import__(test_vals['import_name'],fromlist=[''])
70                print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
71        except:
72            print '%s NOT INSTALLED'% package_name
73
74if sys.platform == 'darwin':
75    print
76    print "MacOS Specific Packages:"
77    for package_name,test_vals in mac_required_package_list.iteritems():
78        try:
79            i = __import__(test_vals['import_name'],fromlist=[''])
80            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
81        except:
82            print '%s NOT INSTALLED'% package_name
83
84
85print
86print "Deprecated Packages"
87print "You can remove these unless you need them for other reasons!"
88for package_name,test_vals in deprecated_package_list.iteritems():
89    try:
90        i = __import__(test_vals['import_name'],fromlist=[''])
91        if package_name == 'pyPdf':
92            #pyPdf doesn't have the version number internally
93            print 'pyPDF Installed (Version unknown)'
94        else:
95            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
96    except:
97        print '%s NOT INSTALLED'% package_name
Note: See TracBrowser for help on using the repository browser.