source: sasview/check_packages.py @ 18da4a8

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.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 18da4a8 was 131d94b, checked in by wojciech, 8 years ago

Adding pyopencl requirement to check_packages and requirements txt

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