![]() |
|
|
Generated: 8 Jan 2009 |
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, | |
| def PathStripper::_check_output_options_cb | ( | option, | ||
| opt_str, | ||||
| value, | ||||
| parser | ||||
| ) | [private] |
Definition at line 29 of file PathStripper.py.
00029 : 00030 if opt_str == "--mktemp" : 00031 if parser.values.output != stdout : 00032 raise OptionValueError("--mktemp cannot be used at the same time as --output") 00033 else : 00034 parser.values.mktemp = True 00035 fd, outname = mkstemp() 00036 parser.values.output = fdopen(fd, "w") 00037 print outname 00038 elif opt_str == "--output" or opt_str == "-o" : 00039 if parser.values.mktemp: 00040 raise OptionValueError("--mktemp cannot be used at the same time as --output") 00041 else : 00042 parser.values.output = open(value, "w") 00043 00044 if __name__ == '__main__':
| def PathStripper::CleanVariable | ( | varname, | ||
| shell, | ||||
| out | ||||
| ) |
Definition at line 18 of file PathStripper.py.
00018 : 00019 if environ.has_key(varname): 00020 pth = StripPath(environ[varname]) 00021 if shell == "csh" or shell.find("csh") != -1 : 00022 out.write("setenv %s %s\n" % (varname, pth)) 00023 elif shell == "sh" or shell.find("sh") != -1 : 00024 out.write("export %s=%s\n" % (varname, pth)) 00025 elif shell == "bat" : 00026 out.write("set %s=%s\n" % (varname, pth)) 00027 00028 def _check_output_options_cb(option, opt_str, value, parser):
| def PathStripper::StripPath | ( | path | ) |
Definition at line 9 of file PathStripper.py.
00009 : 00010 collected = [] 00011 for p in path.split(pathsep): 00012 rp = realpath(p) 00013 if exists(rp) and isdir(rp): 00014 if len(listdir(rp)) != 0: 00015 collected.append(p) 00016 return pathsep.join(collected) 00017 def CleanVariable(varname, shell, out):
| string PathStripper::action = "append" |
Definition at line 50 of file PathStripper.py.
| PathStripper::callback = _check_output_options_cb, |
Definition at line 64 of file PathStripper.py.
| list PathStripper::choices = ['csh','sh','bat'] |
Definition at line 55 of file PathStripper.py.
| string PathStripper::dest = "envlist" |
Definition at line 51 of file PathStripper.py.
| string PathStripper::help = "add environment variable to be processed" |
Definition at line 53 of file PathStripper.py.
| string PathStripper::metavar = "PATHVAR" |
Definition at line 52 of file PathStripper.py.
| tuple PathStripper::parser = OptionParser() |
Definition at line 47 of file PathStripper.py.
| string PathStripper::type = "string" |
Definition at line 60 of file PathStripper.py.