Gaudi Framework, version v20r4

Generated: 8 Jan 2009

GaudiTest::CMT Class Reference

List of all members.


Detailed Description

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

Member Function Documentation

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

Definition at line 211 of file GaudiTest.py.

00211                                 :
00212         if path is None:
00213             path = os.getcwd()
00214         self.path = path
00215     
    def _run_cmt(self,command,args):

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 
########################################################################


Member Data Documentation

Definition at line 214 of file GaudiTest.py.


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

Generated at Thu Jan 8 17:53:59 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004