source: sasview/check_packages.py @ a4deca6

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 a4deca6 was 68aa210, checked in by krzywon, 8 years ago

Added a reader for 1D and 2D CanSAS v2.0 data in HDF5 format. Added the h5py requirement to check_packages.

  • Property mode set to 100644
File size: 4.4 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.6.1','import_name':'numpy','test':'__version__'},
29    'scipy':{'version':'0.10.1','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}
36win_required_package_list = {
37    'comtypes':{'version':'0.6.2','import_name':'comtypes','test':'__version__'},
38    'pywin':{'version':'217','import_name':'pywin','test':'__version__'},
39    'py2exe':{'version':'0.6.9','import_name':'py2exe','test':'__version__'},
40}
41mac_required_package_list = {
42    'py2app':{'version':None,'import_name':'py2app','test':'__version__'},
43}
44
45deprecated_package_list = {
46    'pyPdf':{'version':'1.13','import_name':'pyPdf','test':'__version__'},
47}
48
49print "Checking Required Package Versions...."
50print
51print "Common Packages"
52for package_name,test_vals in common_required_package_list.iteritems():
53    try:
54        i = __import__(test_vals['import_name'],fromlist=[''])
55        if test_vals['test'] == None:
56            print "%s Installed (Unknown version)" % package_name
57        elif package_name == 'lxml':
58            verstring = str(getattr(i,'LXML_VERSION'))
59            print "%s Version Installed: %s"% (package_name,verstring.replace(', ','.').lstrip('(').rstrip(')'))
60        else:
61            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
62    except:
63        print '%s NOT INSTALLED'% package_name
64
65if sys.platform == 'win32':
66    print
67    print "Windows Specific Packages:"
68    for package_name,test_vals in win_required_package_list.iteritems():
69        try:
70            if package_name == "pywin":
71                import win32api
72                fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__,'\\')
73                print "%s Version Installed: %s"% (package_name,fixed_file_info['FileVersionLS'] >> 16)
74            else:
75                i = __import__(test_vals['import_name'],fromlist=[''])
76                print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
77        except:
78            print '%s NOT INSTALLED'% package_name
79
80if sys.platform == 'darwin':
81    print
82    print "MacOS Specific Packages:"
83    for package_name,test_vals in mac_required_package_list.iteritems():
84        try:
85            i = __import__(test_vals['import_name'],fromlist=[''])
86            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
87        except:
88            print '%s NOT INSTALLED'% package_name
89
90
91print
92print "Deprecated Packages"
93print "You can remove these unless you need them for other reasons!"
94for package_name,test_vals in deprecated_package_list.iteritems():
95    try:
96        i = __import__(test_vals['import_name'],fromlist=[''])
97        if package_name == 'pyPdf':
98            #pyPdf doesn't have the version number internally
99            print 'pyPDF Installed (Version unknown)'
100        else:
101            print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))
102    except:
103        print '%s NOT INSTALLED'% package_name
Note: See TracBrowser for help on using the repository browser.