![]() |
|
|
Generated: 8 Jan 2009 |
Small wrapper to call CMT.
Definition at line 208 of file GaudiTest.py.
Public Member Functions | |
| def | __init__ |
| def | __getattr__ |
| def | runtime_env |
| def | show_macro |
Public Attributes | |
| path | |
Private Member Functions | |
| def | _run_cmt |
| def GaudiTest::CMT::__init__ | ( | self, | ||
path = None | ||||
| ) |
| def GaudiTest::CMT::_run_cmt | ( | self, | ||
| command, | ||||
| args | ||||
| ) | [private] |
Definition at line 216 of file GaudiTest.py.
00216 : 00217 # prepare command line 00218 if type(args) is str: 00219 args = [args] 00220 cmd = "cmt %s"%command 00221 for arg in args: 00222 cmd += ' "%s"'%arg 00223 00224 # go to the execution directory 00225 olddir = os.getcwd() 00226 os.chdir(self.path) 00227 # run cmt 00228 result = os.popen4(cmd)[1].read() 00229 # return to the old directory 00230 os.chdir(olddir) 00231 return result 00232 def __getattr__(self,attr):
| def GaudiTest::CMT::__getattr__ | ( | self, | ||
| attr | ||||
| ) |
Definition at line 233 of file GaudiTest.py.
00233 : 00234 return lambda args=[]: self._run_cmt(attr, args) 00235 def runtime_env(self,env = None):
| def GaudiTest::CMT::runtime_env | ( | self, | ||
env = None | ||||
| ) |
Returns a dictionary containing the runtime environment produced by CMT. If a dictionary is passed a modified instance of it is returned.
Definition at line 236 of file GaudiTest.py.
00236 : 00237 """Returns a dictionary containing the runtime environment produced by CMT. 00238 If a dictionary is passed a modified instance of it is returned. 00239 """ 00240 if env is None: 00241 env = {} 00242 for l in self.setup("-csh").splitlines(): 00243 l = l.strip() 00244 if l.startswith("setenv"): 00245 dummy,name,value = l.split(None,3) 00246 env[name] = value.strip('"') 00247 elif l.startswith("unsetenv"): 00248 dummy,name = l.split(None,2) 00249 if name in env: 00250 del env[name] 00251 return env def show_macro(self,k):
| def GaudiTest::CMT::show_macro | ( | self, | ||
| k | ||||
| ) |
Definition at line 252 of file GaudiTest.py.
00252 : 00253 r = self.show(["macro",k]) 00254 if r.find("CMT> Error: symbol not found") >= 0: 00255 return None 00256 else: 00257 return self.show(["macro_value",k]).strip() 00258 ########################################################################
Definition at line 214 of file GaudiTest.py.