Gaudi Framework, version v21r11

Home   Generated: 30 Sep 2010

PathStripper Namespace Reference


Functions

def StripPath
def CleanVariable
def _check_output_options_cb

Variables

tuple parser = OptionParser()
string action = "append"
string dest = "envlist"
string metavar = "PATHVAR"
string help = "add environment variable to be processed"
list choices = ['csh','sh','bat']
string type = "string"
 callback = _check_output_options_cb,


Function Documentation

def PathStripper::_check_output_options_cb (   option,
  opt_str,
  value,
  parser 
) [private]

Definition at line 34 of file PathStripper.py.

00034                                                             :
00035     if opt_str == "--mktemp" :
00036         if parser.values.output != stdout :
00037             raise OptionValueError("--mktemp cannot be used at the same time as --output")
00038         else : 
00039             parser.values.mktemp = True
00040             fd, outname = mkstemp()
00041             parser.values.output = fdopen(fd, "w")
00042             print outname
00043     elif opt_str == "--output" or opt_str == "-o" :
00044         if parser.values.mktemp:
00045             raise OptionValueError("--mktemp cannot be used at the same time as --output")
00046         else :
00047             parser.values.output = open(value, "w")
00048 
00049 
if __name__ == '__main__':

def PathStripper::CleanVariable (   varname,
  shell,
  out 
)

Definition at line 23 of file PathStripper.py.

00023                                       :
00024     if environ.has_key(varname):
00025         pth = StripPath(environ[varname])
00026         if shell == "csh" or shell.find("csh") != -1 :
00027             out.write("setenv %s %s\n" % (varname, pth))
00028         elif shell == "sh" or shell.find("sh") != -1 :
00029             out.write("export %s=%s\n" % (varname, pth))
00030         elif shell == "bat" :
00031             out.write("set %s=%s\n" % (varname, pth))
00032     
00033 
def _check_output_options_cb(option, opt_str, value, parser):

def PathStripper::StripPath (   path  ) 

Definition at line 10 of file PathStripper.py.

00010                    :
00011     collected = []
00012     for p in path.split(pathsep):
00013         rp = realpath(p)
00014         # We keep the entry if it is a directory not empty or a zipfile
00015         try :
00016             if exists(rp) and ((isdir(rp) and listdir(rp)) 
00017                                or is_zipfile(rp)) and p not in collected:
00018                 collected.append(p)
00019         except OSError :
00020             pass
00021     return pathsep.join(collected)
00022 
def CleanVariable(varname, shell, out):


Variable Documentation

string PathStripper::action = "append"

Definition at line 55 of file PathStripper.py.

PathStripper::callback = _check_output_options_cb,

Definition at line 69 of file PathStripper.py.

list PathStripper::choices = ['csh','sh','bat']

Definition at line 60 of file PathStripper.py.

string PathStripper::dest = "envlist"

Definition at line 56 of file PathStripper.py.

string PathStripper::help = "add environment variable to be processed"

Definition at line 58 of file PathStripper.py.

string PathStripper::metavar = "PATHVAR"

Definition at line 57 of file PathStripper.py.

tuple PathStripper::parser = OptionParser()

Definition at line 52 of file PathStripper.py.

string PathStripper::type = "string"

Definition at line 65 of file PathStripper.py.


Generated at Thu Sep 30 09:59:07 2010 for Gaudi Framework, version v21r11 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004