GaudiTest.CMT Class Reference

Public Member Functions

def __init__ (self, path=None)
 
def __getattr__ (self, attr)
 
def runtime_env (self, env=None)
 
def show_macro (self, k)
 

Public Attributes

 path
 

Private Member Functions

def _run_cmt (self, command, args)
 

Detailed Description

Small wrapper to call CMT.

Definition at line 234 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 237 of file GaudiTest.py.

237  def __init__(self,path=None):
238  if path is None:
239  path = os.getcwd()
240  self.path = path
241 
def __init__(self, path=None)
Definition: GaudiTest.py:237

Member Function Documentation

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 259 of file GaudiTest.py.

259  def __getattr__(self,attr):
260  return lambda args=[]: self._run_cmt(attr, args)
261 
def _run_cmt(self, command, args)
Definition: GaudiTest.py:242
def __getattr__(self, attr)
Definition: GaudiTest.py:259
def GaudiTest.CMT._run_cmt (   self,
  command,
  args 
)
private

Definition at line 242 of file GaudiTest.py.

242  def _run_cmt(self,command,args):
243  # prepare command line
244  if type(args) is str:
245  args = [args]
246  cmd = "cmt %s"%command
247  for arg in args:
248  cmd += ' "%s"'%arg
249 
250  # go to the execution directory
251  olddir = os.getcwd()
252  os.chdir(self.path)
253  # run cmt
254  result = os.popen4(cmd)[1].read()
255  # return to the old directory
256  os.chdir(olddir)
257  return result
258 
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:19
def _run_cmt(self, command, args)
Definition: GaudiTest.py:242
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 262 of file GaudiTest.py.

262  def runtime_env(self,env = None):
263  """Returns a dictionary containing the runtime environment produced by CMT.
264  If a dictionary is passed a modified instance of it is returned.
265  """
266  if env is None:
267  env = {}
268  for l in self.setup("-csh").splitlines():
269  l = l.strip()
270  if l.startswith("setenv"):
271  dummy,name,value = l.split(None,3)
272  env[name] = value.strip('"')
273  elif l.startswith("unsetenv"):
274  dummy,name = l.split(None,2)
275  if name in env:
276  del env[name]
277  return env
def runtime_env(self, env=None)
Definition: GaudiTest.py:262
def GaudiTest.CMT.show_macro (   self,
  k 
)

Definition at line 278 of file GaudiTest.py.

278  def show_macro(self,k):
279  r = self.show(["macro",k])
280  if r.find("CMT> Error: symbol not found") >= 0:
281  return None
282  else:
283  return self.show(["macro_value",k]).strip()
284 
285 
def show_macro(self, k)
Definition: GaudiTest.py:278

Member Data Documentation

GaudiTest.CMT.path

Definition at line 240 of file GaudiTest.py.


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