| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Member Functions | List of all members
GaudiTest.CMT Class Reference

## Public Member Functions
def | __init__
def | __getattr__
def | runtime_env
def | show_macro

## Public Attributes
| path

## Private Member Functions
def | _run_cmt

## Detailed Description

    Small wrapper to call CMT.

Definition at line 232 of file GaudiTest.py.

## Constructor & Destructor Documentation

def GaudiTest.CMT.__init__ | ( |  | self,
|  |  | path = `None`
| ) |  |

Definition at line 235 of file GaudiTest.py.

235
236 def __init__(self,path=None):
237 if path is None:
238 path = os.getcwd()
239 self.path = path

## Member Function Documentation

def GaudiTest.CMT.__getattr__ | ( |  | self,
|  |  | attr
| ) |  |

Definition at line 257 of file GaudiTest.py.

257
258 def __getattr__(self,attr):
259 return lambda args=[]: self._run_cmt(attr, args)

def GaudiTest.CMT._run_cmt | ( |  | self,
|  |  | command,
|  |  | args
| ) |  |
| private

Definition at line 240 of file GaudiTest.py.

240
241 def _run_cmt(self,command,args):
242 # prepare command line
243 if type(args) is str:
244 args = [args]
245 cmd = "cmt %s"%command
246 for arg in args:
247 cmd += ' "%s"'%arg
248
249 # go to the execution directory
250 olddir = os.getcwd()
251 os.chdir(self.path)
252 # run cmt
253 result = os.popen4(cmd)[1].read()
254 # return to the old directory
255 os.chdir(olddir)
256 return result

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 260 of file GaudiTest.py.

260
261 def runtime_env(self,env = None):
262 """Returns a dictionary containing the runtime environment produced by CMT.
263 If a dictionary is passed a modified instance of it is returned.
264 """
265 if env is None:
266 env = {}
267 for l in self.setup("-csh").splitlines():
268 l = l.strip()
269 if l.startswith("setenv"):
270 dummy,name,value = l.split(None,3)
271 env[name] = value.strip('"')
272 elif l.startswith("unsetenv"):
273 dummy,name = l.split(None,2)
274 if name in env:
275 del env[name]
return env

def GaudiTest.CMT.show_macro | ( |  | self,
|  |  | k
| ) |  |

Definition at line 276 of file GaudiTest.py.

276
277 def show_macro(self,k):
278 r = self.show(["macro",k])
279 if r.find("CMT> Error: symbol not found") >= 0:
280 return None
281 else:
282 return self.show(["macro_value",k]).strip()
283

## Member Data Documentation

GaudiTest.CMT.path

Definition at line 238 of file GaudiTest.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiPolicy/qmtest_classes/GaudiTest.py