Gaudi Framework, version v23r1

Home   Generated: Wed Feb 29 2012
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

Definition at line 212 of file GaudiTest.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Wed Feb 29 2012 15:31:42 for Gaudi Framework, version v23r1 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004