[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: |
---|
[015eb2b] | 12 | print "No matplotlib: recommending 1.1.0" |
---|
[5c3aafa] | 13 | |
---|
| 14 | try: |
---|
| 15 | import wx |
---|
| 16 | print "wx ", wx.__version__ |
---|
| 17 | except: |
---|
[015eb2b] | 18 | print "No wx: recommending 2.8.12.1" |
---|
[5c3aafa] | 19 | |
---|
| 20 | try: |
---|
| 21 | import scipy |
---|
| 22 | print "scipy ", scipy.__version__ |
---|
| 23 | except: |
---|
[015eb2b] | 24 | print "No scipy: recommending 0.10.0" |
---|
[5c3aafa] | 25 | |
---|
| 26 | try: |
---|
| 27 | import numpy |
---|
| 28 | print "numpy ", numpy.__version__ |
---|
| 29 | except: |
---|
[015eb2b] | 30 | print "No numpy: recommending 1.1.0" |
---|
[5c3aafa] | 31 | |
---|
| 32 | try: |
---|
| 33 | import lxml.etree |
---|
| 34 | print "lxml ", lxml.etree.__version__ |
---|
| 35 | except: |
---|
[015eb2b] | 36 | print "No lxml: recommend 2.3.0" |
---|
[5c3aafa] | 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" |
---|
[015eb2b] | 74 | |
---|
| 75 | try: |
---|
[c4cf266] | 76 | import ho.pisa |
---|
| 77 | print "ho.pisa ", ho.pisa.__version__ |
---|
[015eb2b] | 78 | except: |
---|
| 79 | print "No pisa" |
---|
| 80 | |
---|
[9e338ca] | 81 | |
---|
[5c3aafa] | 82 | def check_system(): |
---|
| 83 | """ |
---|
| 84 | Checks that the system has the necessary modules. |
---|
| 85 | This is an early and more complete variation of the system |
---|
| 86 | check in check_deps() |
---|
| 87 | """ |
---|
| 88 | is_ok = True |
---|
| 89 | msg = '' |
---|
| 90 | try: |
---|
| 91 | import wx |
---|
| 92 | if not wx.__version__.count('2.8.11') and \ |
---|
| 93 | not wx.__version__.count('2.8.12'): |
---|
| 94 | mesg = "wx: Recommending version 2.8.11 or 2.8.12" |
---|
| 95 | msg += mesg + "\n" |
---|
| 96 | print mesg |
---|
| 97 | except: |
---|
| 98 | is_ok = False |
---|
| 99 | mesg = "Error: wxpython 2.8.11 (12) missing" |
---|
| 100 | msg += mesg + "\n" |
---|
| 101 | print mesg |
---|
| 102 | logging.error("wxpython missing") |
---|
[9e338ca] | 103 | |
---|
[5c3aafa] | 104 | try: |
---|
| 105 | import matplotlib |
---|
| 106 | if not matplotlib.__version__.count('0.99.0') and \ |
---|
| 107 | not matplotlib.__version__.count('0.99.1'): |
---|
| 108 | mesg = "matplotlib: Recommending version 0.99.0 or 0.99.1" |
---|
| 109 | msg += mesg + "\n" |
---|
| 110 | print mesg |
---|
| 111 | except: |
---|
| 112 | is_ok = False |
---|
| 113 | mesg = "Error: matplotlib 0.99.0 (1) missing" |
---|
| 114 | msg += mesg + "\n" |
---|
| 115 | print mesg |
---|
| 116 | logging.error("matplotlib missing") |
---|
| 117 | |
---|
| 118 | try: |
---|
| 119 | import numpy |
---|
| 120 | if not numpy.__version__.count('1.4.1'): |
---|
| 121 | mesg = "numpy: Recommending version 1.4.1" |
---|
| 122 | msg += mesg + "\n" |
---|
| 123 | print mesg |
---|
| 124 | except: |
---|
| 125 | is_ok = False |
---|
| 126 | mesg = "Error: numpy 1.4.1 missing" |
---|
| 127 | msg += mesg + "\n" |
---|
| 128 | print mesg |
---|
| 129 | logging.error("numpy missing") |
---|
| 130 | |
---|
| 131 | try: |
---|
| 132 | import scipy |
---|
| 133 | if not scipy.__version__.count('0.7.2'): |
---|
| 134 | mesg = "scipy: Recommending version 0.7.2" |
---|
| 135 | msg += mesg + "\n" |
---|
| 136 | print mesg |
---|
| 137 | except: |
---|
| 138 | is_ok = False |
---|
| 139 | mesg = "Error: scipy 0.7.2 missing" |
---|
| 140 | msg += mesg + "\n" |
---|
| 141 | print mesg |
---|
| 142 | logging.error("scipy missing") |
---|
| 143 | |
---|
| 144 | try: |
---|
| 145 | import periodictable |
---|
| 146 | if not periodictable.__version__.count('1.3.0'): |
---|
| 147 | mesg = "periodictable: Recommending version 1.3.0" |
---|
| 148 | msg += mesg + "\n" |
---|
| 149 | print mesg |
---|
| 150 | except: |
---|
| 151 | print "Trying to install perodic table..." |
---|
| 152 | try: |
---|
| 153 | os.system("easy_install periodictable") |
---|
| 154 | print "installed periodictable" |
---|
| 155 | except: |
---|
| 156 | is_ok = False |
---|
| 157 | mesg = "Error: periodictable missing" |
---|
| 158 | msg += mesg + "\n" |
---|
| 159 | print "easy_install periodictable failed" |
---|
| 160 | logging.error("periodictable missing") |
---|
[08dcf6c8] | 161 | |
---|
[5c3aafa] | 162 | |
---|
| 163 | try: |
---|
| 164 | if sys.platform.count("win32")> 0: |
---|
| 165 | from wx.lib.pdfwin import PDFWindow |
---|
| 166 | except: |
---|
| 167 | is_ok = False |
---|
| 168 | mesg = "comtypes missing" |
---|
| 169 | msg += mesg + "\n" |
---|
| 170 | print mesg |
---|
| 171 | logging.error("comtypes missing") |
---|
| 172 | |
---|
| 173 | try: |
---|
| 174 | if sys.platform.count("win32")> 0: |
---|
| 175 | import win32com |
---|
| 176 | except: |
---|
| 177 | is_ok = False |
---|
| 178 | mesg = "pywin32 missing" |
---|
| 179 | msg += mesg + "\n" |
---|
| 180 | print mesg |
---|
| 181 | logging.error("pywin32 missing") |
---|
| 182 | |
---|
| 183 | try: |
---|
| 184 | import pyparsing |
---|
| 185 | except: |
---|
| 186 | try: |
---|
[00852df] | 187 | os.system("easy_install 'pyparsing==1.5.5'") |
---|
[5c3aafa] | 188 | print "installed pyparsing" |
---|
| 189 | except: |
---|
| 190 | is_ok = False |
---|
| 191 | mesg = "pyparsing missing" |
---|
| 192 | msg += mesg + "\n" |
---|
| 193 | print mesg |
---|
| 194 | print "easy_install pyparsing failed" |
---|
| 195 | logging.error("pyparsing missing") |
---|
| 196 | |
---|
| 197 | if os.system("gcc -dumpversion")==1: |
---|
| 198 | is_ok = False |
---|
| 199 | mesg = "missing mingw/gcc" |
---|
| 200 | msg += mesg + "\n" |
---|
| 201 | print mesg |
---|
| 202 | logging.error("missing mingw/gcc") |
---|
[08dcf6c8] | 203 | |
---|
[5c3aafa] | 204 | return is_ok, msg |
---|
| 205 | |
---|
| 206 | check_deps() |
---|
[9e338ca] | 207 | |
---|