| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Public Attributes | Private Member Functions | List of all members
GaudiTest.CMT Class Reference

## Public Member Functions
def | __init__ (self, path=None)
def | __getattr__ (self, attr)
def | runtime_env (self, env=None)
def | show_macro (self, k)

## Public Attributes
| path

## Private Member Functions
def | _run_cmt (self, command, args)

## Detailed Description

    Small wrapper to call CMT.

Definition at line 252 of file GaudiTest.py.

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 256 of file GaudiTest.py.

256 def __init__(self, path=None):
257 if path is None:
258 path = os.getcwd()
259 self.path = path
260

## Member Function Documentation

## ◆ __getattr__()

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

Definition at line 278 of file GaudiTest.py.

278 def __getattr__(self, attr):
279 return lambda args=[]: self._run_cmt(attr, args)
280

## ◆ _run_cmt()

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

Definition at line 261 of file GaudiTest.py.

261 def _run_cmt(self, command, args):
262 # prepare command line
263 if type(args) is str:
264 args = [args]
265 cmd = "cmt %s" % command
266 for arg in args:
267 cmd += ' "%s"' % arg
268
269 # go to the execution directory
270 olddir = os.getcwd()
271 os.chdir(self.path)
272 # run cmt
273 result = os.popen4(cmd)[1].read()
274 # return to the old directory
275 os.chdir(olddir)
276 return result
277
hivetimeline.read
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:22
gaudirun.type
type
Definition: gaudirun.py:142

## ◆ runtime_env()

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

281 def runtime_env(self, env=None):
282 """Returns a dictionary containing the runtime environment produced by CMT.
283 If a dictionary is passed a modified instance of it is returned.
284 """
285 if env is None:
286 env = {}
287 for l in self.setup("-csh").splitlines():
288 l = l.strip()
289 if l.startswith("setenv"):
290 dummy, name, value = l.split(None, 3)
291 env[name] = value.strip('"')
292 elif l.startswith("unsetenv"):
293 dummy, name = l.split(None, 2)
294 if name in env:
295 del env[name]
296 return env
297

## ◆ show_macro()

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

Definition at line 298 of file GaudiTest.py.

298 def show_macro(self, k):
299 r = self.show(["macro", k])
300 if r.find("CMT> Error: symbol not found") >= 0:
301 return None
302 else:
303 return self.show(["macro_value", k]).strip()
304
305
306 # Locates an executable in the executables path ($PATH) and returns the full
307 # path to it.
308 # If the executable cannot be found, None is returned

## Member Data Documentation

## ◆ path

GaudiTest.CMT.path

Definition at line 259 of file GaudiTest.py.

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

- GaudiPolicy/qmtest_classes/GaudiTest.py