Last change
on this file since 12997 was 12944, checked in by jschierm, 13 years ago |
CHG: Made python docstrings have consistent indentation.
|
File size:
862 bytes
|
Line | |
---|
1 | import os
|
---|
2 | from issmdir import *
|
---|
3 | from MatlabFuncs import *
|
---|
4 |
|
---|
5 | def ismumps():
|
---|
6 | """
|
---|
7 | ISMUMPS - figure out if MUMPS package was compiled with ISSM
|
---|
8 |
|
---|
9 | Usage:
|
---|
10 | flag=ismumps();
|
---|
11 | """
|
---|
12 |
|
---|
13 | configfile=os.path.join(issmdir(),'bin','config.h') #should find it in the install target
|
---|
14 | if not os.path.exists(configfile):
|
---|
15 | raise RuntimeError("File '%s' not found. ISSM has not been configured yet!" % configfile)
|
---|
16 |
|
---|
17 | #go through the file, and recover the line we want
|
---|
18 | flag=2
|
---|
19 | try:
|
---|
20 | fid=open(configfile,'r')
|
---|
21 | except IOError as e:
|
---|
22 | raise IOError("could not open file: '%s'" % configfile)
|
---|
23 |
|
---|
24 | for tline in fid:
|
---|
25 | if strncmp(tline,'/* #undef _HAVE_MUMPS_ */',25):
|
---|
26 | flag=0
|
---|
27 | break
|
---|
28 | if strncmp(tline,'#define _HAVE_MUMPS_',20):
|
---|
29 | flag=1
|
---|
30 | break
|
---|
31 |
|
---|
32 | fid.close()
|
---|
33 | if flag==2:
|
---|
34 | raise RuntimeError("could not determine whether MUMPS was or was not compiled.")
|
---|
35 |
|
---|
36 | return flag
|
---|
37 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.