[9e338ca] | 1 | """ |
---|
| 2 | Check dependencies |
---|
| 3 | """ |
---|
[60bca1a] | 4 | import sys |
---|
[2a48bb0] | 5 | print sys.version |
---|
[60bca1a] | 6 | |
---|
[5c3aafa] | 7 | def check_deps(): |
---|
| 8 | try: |
---|
| 9 | import matplotlib |
---|
| 10 | print "matplotlib ", matplotlib.__version__ |
---|
| 11 | except: |
---|
| 12 | print "No matplotlib" |
---|
| 13 | |
---|
| 14 | try: |
---|
| 15 | import wx |
---|
| 16 | print "wx ", wx.__version__ |
---|
| 17 | except: |
---|
| 18 | print "No wx" |
---|
| 19 | |
---|
| 20 | try: |
---|
| 21 | import scipy |
---|
| 22 | print "scipy ", scipy.__version__ |
---|
| 23 | except: |
---|
| 24 | print "No scipy" |
---|
| 25 | |
---|
| 26 | try: |
---|
| 27 | import numpy |
---|
| 28 | print "numpy ", numpy.__version__ |
---|
| 29 | except: |
---|
| 30 | print "No numpy" |
---|
| 31 | |
---|
| 32 | try: |
---|
| 33 | import lxml.etree |
---|
| 34 | print "lxml ", lxml.etree.__version__ |
---|
| 35 | except: |
---|
| 36 | print "No lxml" |
---|
| 37 | |
---|
| 38 | try: |
---|
| 39 | import reportlab |
---|
| 40 | print "reportlab ", reportlab.Version |
---|
| 41 | except: |
---|
| 42 | print "No reportlab" |
---|
| 43 | |
---|
| 44 | try: |
---|
| 45 | import PIL |
---|
| 46 | print "PIL" |
---|
| 47 | except: |
---|
| 48 | print "No PIL" |
---|
| 49 | |
---|
| 50 | # The following is necessary to build an app |
---|
| 51 | try: |
---|
| 52 | import py2app |
---|
| 53 | print "py2app ", py2app.__version__ |
---|
| 54 | except: |
---|
| 55 | print "No py2app: recommending version >= 0.6.4" |
---|
| 56 | |
---|
| 57 | try: |
---|
| 58 | import altgraph |
---|
| 59 | print "altgraph ", altgraph.__version__ |
---|
| 60 | except: |
---|
| 61 | print "No altgraph" |
---|
| 62 | |
---|
| 63 | try: |
---|
| 64 | import modulegraph |
---|
| 65 | print "modulegraph ", modulegraph.__version__ |
---|
| 66 | except: |
---|
| 67 | print "No modulegraph: recommending version >= 0.9.1" |
---|
| 68 | |
---|
| 69 | try: |
---|
| 70 | import macholib |
---|
| 71 | print "macholib ", macholib.__version__ |
---|
| 72 | except: |
---|
| 73 | print "No macholib: recommending version >= 1.4.3" |
---|
[9e338ca] | 74 | |
---|
[5c3aafa] | 75 | def check_system(): |
---|
| 76 | """ |
---|
| 77 | Checks that the system has the necessary modules. |
---|
| 78 | This is an early and more complete variation of the system |
---|
| 79 | check in check_deps() |
---|
| 80 | """ |
---|
| 81 | is_ok = True |
---|
| 82 | msg = '' |
---|
| 83 | try: |
---|
| 84 | import wx |
---|
| 85 | if not wx.__version__.count('2.8.11') and \ |
---|
| 86 | not wx.__version__.count('2.8.12'): |
---|
| 87 | mesg = "wx: Recommending version 2.8.11 or 2.8.12" |
---|
| 88 | msg += mesg + "\n" |
---|
| 89 | print mesg |
---|
| 90 | except: |
---|
| 91 | is_ok = False |
---|
| 92 | mesg = "Error: wxpython 2.8.11 (12) missing" |
---|
| 93 | msg += mesg + "\n" |
---|
| 94 | print mesg |
---|
| 95 | logging.error("wxpython missing") |
---|
[9e338ca] | 96 | |
---|
[5c3aafa] | 97 | try: |
---|
| 98 | import matplotlib |
---|
| 99 | if not matplotlib.__version__.count('0.99.0') and \ |
---|
| 100 | not matplotlib.__version__.count('0.99.1'): |
---|
| 101 | mesg = "matplotlib: Recommending version 0.99.0 or 0.99.1" |
---|
| 102 | msg += mesg + "\n" |
---|
| 103 | print mesg |
---|
| 104 | except: |
---|
| 105 | is_ok = False |
---|
| 106 | mesg = "Error: matplotlib 0.99.0 (1) missing" |
---|
| 107 | msg += mesg + "\n" |
---|
| 108 | print mesg |
---|
| 109 | logging.error("matplotlib missing") |
---|
| 110 | |
---|
| 111 | try: |
---|
| 112 | import numpy |
---|
| 113 | if not numpy.__version__.count('1.4.1'): |
---|
| 114 | mesg = "numpy: Recommending version 1.4.1" |
---|
| 115 | msg += mesg + "\n" |
---|
| 116 | print mesg |
---|
| 117 | except: |
---|
| 118 | is_ok = False |
---|
| 119 | mesg = "Error: numpy 1.4.1 missing" |
---|
| 120 | msg += mesg + "\n" |
---|
| 121 | print mesg |
---|
| 122 | logging.error("numpy missing") |
---|
| 123 | |
---|
| 124 | try: |
---|
| 125 | import scipy |
---|
| 126 | if not scipy.__version__.count('0.7.2'): |
---|
| 127 | mesg = "scipy: Recommending version 0.7.2" |
---|
| 128 | msg += mesg + "\n" |
---|
| 129 | print mesg |
---|
| 130 | except: |
---|
| 131 | is_ok = False |
---|
| 132 | mesg = "Error: scipy 0.7.2 missing" |
---|
| 133 | msg += mesg + "\n" |
---|
| 134 | print mesg |
---|
| 135 | logging.error("scipy missing") |
---|
| 136 | |
---|
| 137 | try: |
---|
| 138 | import periodictable |
---|
| 139 | if not periodictable.__version__.count('1.3.0'): |
---|
| 140 | mesg = "periodictable: Recommending version 1.3.0" |
---|
| 141 | msg += mesg + "\n" |
---|
| 142 | print mesg |
---|
| 143 | except: |
---|
| 144 | print "Trying to install perodic table..." |
---|
| 145 | try: |
---|
| 146 | os.system("easy_install periodictable") |
---|
| 147 | print "installed periodictable" |
---|
| 148 | except: |
---|
| 149 | is_ok = False |
---|
| 150 | mesg = "Error: periodictable missing" |
---|
| 151 | msg += mesg + "\n" |
---|
| 152 | print "easy_install periodictable failed" |
---|
| 153 | logging.error("periodictable missing") |
---|
[08dcf6c8] | 154 | |
---|
[5c3aafa] | 155 | |
---|
| 156 | try: |
---|
| 157 | if sys.platform.count("win32")> 0: |
---|
| 158 | from wx.lib.pdfwin import PDFWindow |
---|
| 159 | except: |
---|
| 160 | is_ok = False |
---|
| 161 | mesg = "comtypes missing" |
---|
| 162 | msg += mesg + "\n" |
---|
| 163 | print mesg |
---|
| 164 | logging.error("comtypes missing") |
---|
| 165 | |
---|
| 166 | try: |
---|
| 167 | if sys.platform.count("win32")> 0: |
---|
| 168 | import win32com |
---|
| 169 | except: |
---|
| 170 | is_ok = False |
---|
| 171 | mesg = "pywin32 missing" |
---|
| 172 | msg += mesg + "\n" |
---|
| 173 | print mesg |
---|
| 174 | logging.error("pywin32 missing") |
---|
| 175 | |
---|
| 176 | try: |
---|
| 177 | import pyparsing |
---|
| 178 | except: |
---|
| 179 | try: |
---|
| 180 | os.system("easy_install pyparsing") |
---|
| 181 | print "installed pyparsing" |
---|
| 182 | except: |
---|
| 183 | is_ok = False |
---|
| 184 | mesg = "pyparsing missing" |
---|
| 185 | msg += mesg + "\n" |
---|
| 186 | print mesg |
---|
| 187 | print "easy_install pyparsing failed" |
---|
| 188 | logging.error("pyparsing missing") |
---|
| 189 | |
---|
| 190 | if os.system("gcc -dumpversion")==1: |
---|
| 191 | is_ok = False |
---|
| 192 | mesg = "missing mingw/gcc" |
---|
| 193 | msg += mesg + "\n" |
---|
| 194 | print mesg |
---|
| 195 | logging.error("missing mingw/gcc") |
---|
[08dcf6c8] | 196 | |
---|
[5c3aafa] | 197 | return is_ok, msg |
---|
| 198 | |
---|
| 199 | check_deps() |
---|
[9e338ca] | 200 | |
---|