The Gaudi Framework  v31r0 (aeb156f0)
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 252 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 256 of file GaudiTest.py.

256  def __init__(self, path=None):
257  if path is None:
258  path = os.getcwd()
259  self.path = path
260 
def __init__(self, path=None)
Definition: GaudiTest.py:256

Member Function Documentation

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 278 of file GaudiTest.py.

278  def __getattr__(self, attr):
279  return lambda args=[]: self._run_cmt(attr, args)
280 
def _run_cmt(self, command, args)
Definition: GaudiTest.py:261
def __getattr__(self, attr)
Definition: GaudiTest.py:278
def GaudiTest.CMT._run_cmt (   self,
  command,
  args 
)
private

Definition at line 261 of file GaudiTest.py.

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

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

Definition at line 298 of file GaudiTest.py.

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

Member Data Documentation

GaudiTest.CMT.path

Definition at line 259 of file GaudiTest.py.


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