The Gaudi Framework  v33r0 (d5ea422b)
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 263 of file GaudiTest.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 267 of file GaudiTest.py.

267  def __init__(self, path=None):
268  if path is None:
269  path = os.getcwd()
270  self.path = path
271 

Member Function Documentation

◆ __getattr__()

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 289 of file GaudiTest.py.

289  def __getattr__(self, attr):
290  return lambda args=[]: self._run_cmt(attr, args)
291 

◆ _run_cmt()

def GaudiTest.CMT._run_cmt (   self,
  command,
  args 
)
private

Definition at line 272 of file GaudiTest.py.

272  def _run_cmt(self, command, args):
273  # prepare command line
274  if type(args) is str:
275  args = [args]
276  cmd = "cmt %s" % command
277  for arg in args:
278  cmd += ' "%s"' % arg
279 
280  # go to the execution directory
281  olddir = os.getcwd()
282  os.chdir(self.path)
283  # run cmt
284  result = os.popen4(cmd)[1].read()
285  # return to the old directory
286  os.chdir(olddir)
287  return result
288 
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:33

◆ runtime_env()

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 292 of file GaudiTest.py.

292  def runtime_env(self, env=None):
293  """Returns a dictionary containing the runtime environment produced by CMT.
294  If a dictionary is passed a modified instance of it is returned.
295  """
296  if env is None:
297  env = {}
298  for l in self.setup("-csh").splitlines():
299  l = l.strip()
300  if l.startswith("setenv"):
301  dummy, name, value = l.split(None, 3)
302  env[name] = value.strip('"')
303  elif l.startswith("unsetenv"):
304  dummy, name = l.split(None, 2)
305  if name in env:
306  del env[name]
307  return env
308 

◆ show_macro()

def GaudiTest.CMT.show_macro (   self,
  k 
)

Definition at line 309 of file GaudiTest.py.

309  def show_macro(self, k):
310  r = self.show(["macro", k])
311  if r.find("CMT> Error: symbol not found") >= 0:
312  return None
313  else:
314  return self.show(["macro_value", k]).strip()
315 
316 
317 # Locates an executable in the executables path ($PATH) and returns the full
318 # path to it.
319 # If the executable cannot be found, None is returned

Member Data Documentation

◆ path

GaudiTest.CMT.path

Definition at line 270 of file GaudiTest.py.


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