Changeset 725de411 in sasview
- Timestamp:
- Mar 16, 2017 11:10:27 PM (8 years ago)
- 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- f433e6a
- Parents:
- c08756f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
check_packages.py
r131d94b r725de411 2 2 Checking and reinstalling the external packages 3 3 """ 4 import os 4 from __future__ import print_function 5 5 6 import sys 6 7 … … 16 17 17 18 common_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'},19 'setuptools': {'version': '0.6c11', 'import_name': 'setuptools', 'test': '__version__'}, 20 'pyparsing': {'version': '1.5.5', 'import_name': 'pyparsing', 'test': '__version__'}, 21 'html5lib': {'version': '0.95', 'import_name': 'html5lib', 'test': '__version__'}, 22 'reportlab': {'version': '2.5', 'import_name': 'reportlab', 'test': 'Version'}, 23 'h5py': {'version': '2.5', 'import_name': 'h5py', 'test': '__version__'}, 24 'lxml': {'version': '2.3', 'import_name': 'lxml.etree', 'test': 'LXML_VERSION'}, 25 'PIL': {'version': '1.1.7', 'import_name': 'Image', 'test': 'VERSION'}, 26 'pylint': {'version': None, 'import_name': 'pylint', 'test': None}, 27 'periodictable': {'version': '1.3.0', 'import_name': 'periodictable', 'test': '__version__'}, 28 'bumps': {'version': '0.7.5.9', 'import_name': 'bumps', 'test': '__version__'}, 29 'numpy': {'version': '1.7.1', 'import_name': 'numpy', 'test': '__version__'}, 30 'scipy': {'version': '0.18.0', 'import_name': 'scipy', 'test': '__version__'}, 31 'wx': {'version': '2.8.12.1', 'import_name': 'wx', 'test': '__version__'}, 32 'matplotlib': {'version': '1.1.0', 'import_name': 'matplotlib', 'test': '__version__'}, 33 'xhtml2pdf': {'version': '3.0.33', 'import_name': 'xhtml2pdf', 'test': '__version__'}, 34 'sphinx': {'version': '1.2.1', 'import_name': 'sphinx', 'test': '__version__'}, 35 'unittest-xml-reporting': {'version': '1.10.0', 'import_name': 'xmlrunner', 'test': '__version__'}, 36 'pyopencl': {'version': '2015.1', 'import_name': 'pyopencl', 'test': 'VERSION_TEXT'}, 36 37 } 37 38 win_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__'},39 'comtypes': {'version': '0.6.2', 'import_name': 'comtypes', 'test': '__version__'}, 40 'pywin': {'version': '217', 'import_name': 'pywin', 'test': '__version__'}, 41 'py2exe': {'version': '0.6.9', 'import_name': 'py2exe', 'test': '__version__'}, 41 42 } 42 43 mac_required_package_list = { 43 'py2app': {'version':None,'import_name':'py2app','test':'__version__'},44 'py2app': {'version': None, 'import_name': 'py2app', 'test': '__version__'}, 44 45 } 45 46 46 47 deprecated_package_list = { 47 'pyPdf': {'version':'1.13','import_name':'pyPdf','test':'__version__'},48 'pyPdf': {'version': '1.13', 'import_name': 'pyPdf', 'test': '__version__'}, 48 49 } 49 50 50 print "Checking Required Package Versions...." 51 print 52 print "Common Packages" 53 for package_name,test_vals in common_required_package_list.iteritems(): 51 print("Checking Required Package Versions....") 52 print("") 53 print("Common Packages") 54 55 for package_name, test_vals in common_required_package_list.items(): 54 56 try: 55 i = __import__(test_vals['import_name'], fromlist=[''])57 i = __import__(test_vals['import_name'], fromlist=['']) 56 58 if test_vals['test'] == None: 57 print "%s Installed (Unknown version)" % package_name59 print("%s Installed (Unknown version)" % package_name) 58 60 elif package_name == 'lxml': 59 verstring = str(getattr(i, 'LXML_VERSION'))60 print "%s Version Installed: %s"% (package_name,verstring.replace(', ','.').lstrip('(').rstrip(')'))61 verstring = str(getattr(i, 'LXML_VERSION')) 62 print("%s Version Installed: %s"% (package_name, verstring.replace(', ', '.').lstrip('(').rstrip(')'))) 61 63 else: 62 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))63 except :64 print '%s NOT INSTALLED'% package_name64 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 65 except ImportError: 66 print('%s NOT INSTALLED'% package_name) 65 67 66 68 if sys.platform == 'win32': 67 print 68 print "Windows Specific Packages:"69 for package_name, test_vals in win_required_package_list.iteritems():69 print("") 70 print("Windows Specific Packages:") 71 for package_name, test_vals in win_required_package_list.items(): 70 72 try: 71 73 if package_name == "pywin": 72 74 import win32api 73 fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__, '\\')74 print "%s Version Installed: %s"% (package_name,fixed_file_info['FileVersionLS'] >> 16)75 fixed_file_info = win32api.GetFileVersionInfo(win32api.__file__, '\\') 76 print("%s Version Installed: %s"% (package_name, fixed_file_info['FileVersionLS'] >> 16)) 75 77 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_name78 i = __import__(test_vals['import_name'], fromlist=['']) 79 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 80 except ImportError: 81 print('%s NOT INSTALLED'% package_name) 80 82 81 83 if sys.platform == 'darwin': 82 print 83 print "MacOS Specific Packages:"84 for package_name, test_vals in mac_required_package_list.iteritems():84 print("") 85 print("MacOS Specific Packages:") 86 for package_name, test_vals in mac_required_package_list.items(): 85 87 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_name88 i = __import__(test_vals['import_name'], fromlist=['']) 89 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 90 except ImportError: 91 print('%s NOT INSTALLED'% package_name) 90 92 91 93 92 print 93 print "Deprecated Packages"94 print "You can remove these unless you need them for other reasons!"95 for package_name, test_vals in deprecated_package_list.iteritems():94 print("") 95 print("Deprecated Packages") 96 print("You can remove these unless you need them for other reasons!") 97 for package_name, test_vals in deprecated_package_list.items(): 96 98 try: 97 i = __import__(test_vals['import_name'], fromlist=[''])99 i = __import__(test_vals['import_name'], fromlist=['']) 98 100 if package_name == 'pyPdf': 99 # pyPdf doesn't have the version number internally100 print 'pyPDF Installed (Version unknown)'101 # pyPdf doesn't have the version number internally 102 print('pyPDF Installed (Version unknown)') 101 103 else: 102 print "%s Version Installed: %s"% (package_name,getattr(i,test_vals['test']))103 except :104 print '%s NOT INSTALLED'% package_name104 print("%s Version Installed: %s"% (package_name, getattr(i, test_vals['test']))) 105 except ImportError: 106 print('%s NOT INSTALLED'% package_name)
Note: See TracChangeset
for help on using the changeset viewer.