| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

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

## Member Function Documentation

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

Definition at line 214 of file GaudiTest.py.

    00214                                 :
    00215         if path is None:
    00216             path = os.getcwd()
    00217         self.path = path
    00218
        def _run_cmt(self,command,args):

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

Definition at line 219 of file GaudiTest.py.

    00219                                    :
    00220         # prepare command line
    00221         if type(args) is str:
    00222             args = [args]
    00223         cmd = "cmt %s"%command
    00224         for arg in args:
    00225             cmd += ' "%s"'%arg
    00226
    00227         # go to the execution directory
    00228         olddir = os.getcwd()
    00229         os.chdir(self.path)
    00230         # run cmt
    00231         result = os.popen4(cmd)[1].read()
    00232         # return to the old directory
    00233         os.chdir(olddir)
    00234         return result
    00235
        def __getattr__(self,attr):

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

Definition at line 236 of file GaudiTest.py.

    00236                               :
    00237         return lambda args=[]: self._run_cmt(attr, args)
    00238
        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 239 of file GaudiTest.py.

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

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

Definition at line 255 of file GaudiTest.py.

    00255                           :
    00256         r = self.show(["macro",k])
    00257         if r.find("CMT> Error: symbol not found") >= 0:
    00258             return None
    00259         else:
    00260             return self.show(["macro_value",k]).strip()
    00261
    ## Locates an executable in the executables path ($PATH) and returns the full

## Member Data Documentation

GaudiTest::CMT::path

Definition at line 217 of file GaudiTest.py.

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

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