The Gaudi Framework  v30r3 (a5ef0a68)
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 245 of file GaudiTest.py.

Constructor & Destructor Documentation

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

Definition at line 249 of file GaudiTest.py.

249  def __init__(self, path=None):
250  if path is None:
251  path = os.getcwd()
252  self.path = path
253 
def __init__(self, path=None)
Definition: GaudiTest.py:249

Member Function Documentation

def GaudiTest.CMT.__getattr__ (   self,
  attr 
)

Definition at line 271 of file GaudiTest.py.

271  def __getattr__(self, attr):
272  return lambda args=[]: self._run_cmt(attr, args)
273 
def _run_cmt(self, command, args)
Definition: GaudiTest.py:254
def __getattr__(self, attr)
Definition: GaudiTest.py:271
def GaudiTest.CMT._run_cmt (   self,
  command,
  args 
)
private

Definition at line 254 of file GaudiTest.py.

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

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

Definition at line 291 of file GaudiTest.py.

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

Member Data Documentation

GaudiTest.CMT.path

Definition at line 252 of file GaudiTest.py.


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