Gaudi Framework, version v23r7

Home   Generated: Wed Mar 20 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Member Functions | List of all members
GaudiTest.CMT Class Reference

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.

213  def __init__(self,path=None):
214  if path is None:
215  path = os.getcwd()
216  self.path = path

Member Function Documentation

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 234 of file GaudiTest.py.

235  def __getattr__(self,attr):
236  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.

218  def _run_cmt(self,command,args):
219  # prepare command line
220  if type(args) is str:
221  args = [args]
222  cmd = "cmt %s"%command
223  for arg in args:
224  cmd += ' "%s"'%arg
225 
226  # go to the execution directory
227  olddir = os.getcwd()
228  os.chdir(self.path)
229  # run cmt
230  result = os.popen4(cmd)[1].read()
231  # return to the old directory
232  os.chdir(olddir)
233  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.

238  def runtime_env(self,env = None):
239  """Returns a dictionary containing the runtime environment produced by CMT.
240  If a dictionary is passed a modified instance of it is returned.
241  """
242  if env is None:
243  env = {}
244  for l in self.setup("-csh").splitlines():
245  l = l.strip()
246  if l.startswith("setenv"):
247  dummy,name,value = l.split(None,3)
248  env[name] = value.strip('"')
249  elif l.startswith("unsetenv"):
250  dummy,name = l.split(None,2)
251  if name in env:
252  del env[name]
return env
def GaudiTest.CMT.show_macro (   self,
  k 
)

Definition at line 253 of file GaudiTest.py.

254  def show_macro(self,k):
255  r = self.show(["macro",k])
256  if r.find("CMT> Error: symbol not found") >= 0:
257  return None
258  else:
259  return self.show(["macro_value",k]).strip()

Member Data Documentation

GaudiTest.CMT.path

Definition at line 215 of file GaudiTest.py.


The documentation for this class was generated from the following file:
Generated at Wed Mar 20 2013 17:59:51 for Gaudi Framework, version v23r7 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004