| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 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 31 of file PathStripper.py.

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

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

Definition at line 20 of file PathStripper.py.

    00020                                       :
    00021     if environ.has_key(varname):
    00022         pth = StripPath(environ[varname])
    00023         if shell == "csh" or shell.find("csh") != -1 :
    00024             out.write("setenv %s %s\n" % (varname, pth))
    00025         elif shell == "sh" or shell.find("sh") != -1 :
    00026             out.write("export %s=%s\n" % (varname, pth))
    00027         elif shell == "bat" :
    00028             out.write("set %s=%s\n" % (varname, pth))
    00029
    00030
    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         if exists(rp) and ((isdir(rp) and listdir(rp))
    00016                            or is_zipfile(rp)):
    00017             collected.append(p)
    00018     return pathsep.join(collected)
    00019
    def CleanVariable(varname, shell, out):

## Variable Documentation

string PathStripper::action = "append"

Definition at line 52 of file PathStripper.py.

PathStripper::callback = _check_output_options_cb,

Definition at line 66 of file PathStripper.py.

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

Definition at line 57 of file PathStripper.py.

string PathStripper::dest = "envlist"

Definition at line 53 of file PathStripper.py.

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

Definition at line 55 of file PathStripper.py.

string PathStripper::metavar = "PATHVAR"

Definition at line 54 of file PathStripper.py.

tuple PathStripper::parser = OptionParser()

Definition at line 49 of file PathStripper.py.

string PathStripper::type = "string"

Definition at line 62 of file PathStripper.py.