Gaudi Framework, version v23r10

Home   Generated: Mon Sep 30 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 212 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 215 of file GaudiTest.py.

216  def __init__(self,path=None):
217  if path is None:
218  path = os.getcwd()
219  self.path = path

Member Function Documentation

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 237 of file GaudiTest.py.

238  def __getattr__(self,attr):
239  return lambda args=[]: self._run_cmt(attr, args)
def GaudiTest.CMT._run_cmt (   self,
  command,
  args 
)
private

Definition at line 220 of file GaudiTest.py.

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

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

Definition at line 256 of file GaudiTest.py.

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

Member Data Documentation

GaudiTest.CMT.path

Definition at line 218 of file GaudiTest.py.


The documentation for this class was generated from the following file:
Generated at Mon Sep 30 2013 14:52:08 for Gaudi Framework, version v23r10 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004