The Gaudi Framework  v32r2 (46d42edc)
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 253 of file GaudiTest.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 257 of file GaudiTest.py.

257  def __init__(self, path=None):
258  if path is None:
259  path = os.getcwd()
260  self.path = path
261 

Member Function Documentation

◆ __getattr__()

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 279 of file GaudiTest.py.

279  def __getattr__(self, attr):
280  return lambda args=[]: self._run_cmt(attr, args)
281 

◆ _run_cmt()

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

Definition at line 262 of file GaudiTest.py.

262  def _run_cmt(self, command, args):
263  # prepare command line
264  if type(args) is str:
265  args = [args]
266  cmd = "cmt %s" % command
267  for arg in args:
268  cmd += ' "%s"' % arg
269 
270  # go to the execution directory
271  olddir = os.getcwd()
272  os.chdir(self.path)
273  # run cmt
274  result = os.popen4(cmd)[1].read()
275  # return to the old directory
276  os.chdir(olddir)
277  return result
278 
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:23

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

282  def runtime_env(self, env=None):
283  """Returns a dictionary containing the runtime environment produced by CMT.
284  If a dictionary is passed a modified instance of it is returned.
285  """
286  if env is None:
287  env = {}
288  for l in self.setup("-csh").splitlines():
289  l = l.strip()
290  if l.startswith("setenv"):
291  dummy, name, value = l.split(None, 3)
292  env[name] = value.strip('"')
293  elif l.startswith("unsetenv"):
294  dummy, name = l.split(None, 2)
295  if name in env:
296  del env[name]
297  return env
298 

◆ show_macro()

def GaudiTest.CMT.show_macro (   self,
  k 
)

Definition at line 299 of file GaudiTest.py.

299  def show_macro(self, k):
300  r = self.show(["macro", k])
301  if r.find("CMT> Error: symbol not found") >= 0:
302  return None
303  else:
304  return self.show(["macro_value", k]).strip()
305 
306 
307 # Locates an executable in the executables path ($PATH) and returns the full
308 # path to it.
309 # If the executable cannot be found, None is returned

Member Data Documentation

◆ path

GaudiTest.CMT.path

Definition at line 260 of file GaudiTest.py.


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