source: trunk/python/Rappture/tools.py @ 829

Last change on this file since 829 was 511, checked in by dkearney, 18 years ago

moving all .h files to their respective src directories, updating tools.py to include python's re module, updated setup.py.in to use .h files from the installed version of rappture and to adapt to the new location of .h files. .h files are now all stored in the lib directory under the rappture installation folder. this should simplify people's code, so they dont have to include wierd search paths for header files. adjusted the paths in rappture.in, allowing people to use their own version of python and perl. octave on the other hand is still broken for people downloading our binary and not using libhdf5-1.6.2. src's makefile.in was modified to copy the .h files from the core and cee directories over to the rappture installation directory. the top level makefile.in has all kinds of changes mainly you can now type in ./configure --prefix=... --with-matlab=... and then make install. this will build and install the gui, language bindings, and examples. these changes will probably break the automatic builds but the necessary changes to the rappture-runtime package should be committed in good time.

File size: 1.0 KB
Line 
1# ----------------------------------------------------------------------
2#
3# ======================================================================
4#  AUTHOR:  Derrick Kearney, Purdue University
5#  Copyright (c) 2005  Purdue Research Foundation, West Lafayette, IN
6# ======================================================================
7
8import sys, os, re
9
10def getCommandOutput(command):
11    childin,childout,childerr = os.popen3(command)
12    data = childout.read()
13    err = childerr.read()
14    errcode = childout.close()
15    if err:
16        error = '%s->%s' % (command, err)
17        raise RuntimeError, error
18    return data
19
20def getDriverNumber(driverFileName):
21    driverNumRslt = re.search(r'[0-9]+',os.path.split(driverFileName)[1])
22    if driverNumRslt == None:
23        return None
24    return driverNumRslt.group()
25
26
27def writeFile(fileName,text):
28    file_object = open(fileName, "w")
29    if file_object:
30        file_object.write(text)
31        file_object.close()
32    else:
33        raise RuntimeError, 'could not open %s for writing' % (fileName)
Note: See TracBrowser for help on using the repository browser.