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