| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Functions | Variables

# 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.

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

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

Definition at line 23 of file PathStripper.py.

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

def PathStripper::StripPath | ( |  | path ) |

Definition at line 10 of file PathStripper.py.

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

## 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.

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines