| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Public Attributes | Private Member Functions

# GaudiTest::CMT Class Reference

List of all members.

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

## Constructor & Destructor Documentation

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

Definition at line 212 of file GaudiTest.py.

    00213                                 :
    00214         if path is None:
    00215             path = os.getcwd()
    00216         self.path = path

## Member Function Documentation

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

Definition at line 234 of file GaudiTest.py.

    00235                               :
    00236         return lambda args=[]: self._run_cmt(attr, args)

def GaudiTest::CMT::_run_cmt | ( |  | self,
|  |  | command,
|  |  | args
| ) |  | `[private]`

Definition at line 217 of file GaudiTest.py.

    00218                                    :
    00219         # prepare command line
    00220         if type(args) is str:
    00221             args = [args]
    00222         cmd = "cmt %s"%command
    00223         for arg in args:
    00224             cmd += ' "%s"'%arg
    00225
    00226         # go to the execution directory
    00227         olddir = os.getcwd()
    00228         os.chdir(self.path)
    00229         # run cmt
    00230         result = os.popen4(cmd)[1].read()
    00231         # return to the old directory
    00232         os.chdir(olddir)
    00233         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 237 of file GaudiTest.py.

    00238                                     :
    00239         """Returns a dictionary containing the runtime environment produced by CMT.
    00240         If a dictionary is passed a modified instance of it is returned.
    00241         """
    00242         if env is None:
    00243             env = {}
    00244         for l in self.setup("-csh").splitlines():
    00245             l = l.strip()
    00246             if l.startswith("setenv"):
    00247                 dummy,name,value = l.split(None,3)
    00248                 env[name] = value.strip('"')
    00249             elif l.startswith("unsetenv"):
    00250                 dummy,name = l.split(None,2)
    00251                 if name in env:
    00252                     del env[name]
            return env

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

Definition at line 253 of file GaudiTest.py.

    00254                           :
    00255         r = self.show(["macro",k])
    00256         if r.find("CMT> Error: symbol not found") >= 0:
    00257             return None
    00258         else:
    00259             return self.show(["macro_value",k]).strip()

## Member Data Documentation

GaudiTest::CMT::path

Definition at line 212 of file GaudiTest.py.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines