2 from TkAlExceptions
import AllInOneError
6 """This function replaces `.oO[key]Oo.` by `the_map[key]` in target.
9 - `target`: String which contains symbolic tags of the form `.oO[key]Oo.`
10 - `the_map`: Dictionary which has to contain the `key`s in `target` as keys
17 while ".oO[" in result
and "]Oo." in result:
19 result = result.replace(
".oO["+key+
"]Oo.",the_map[key])
21 if iteration > lifeSaver:
23 for line
in result.splitlines():
24 if ".oO[" in result
and "]Oo." in line:
25 problematicLines +=
"%s\n"%line
26 msg = (
"Oh Dear, there seems to be an endless loop in "
27 "replaceByMap!!\n%s\nrepMap"%problematicLines)
33 """This function executes `command` and returns it output.
36 - `command`: Shell command to be invoked by this function.
39 child = os.popen(command)
43 raise RuntimeError,
'%s failed w/ exit code %d' % (command, err)
48 """This function checks if the directory given by `path` exists.
51 - `path`: Path to castor directory
56 containingPath = os.path.join( *path.split(
"/")[:-1] )
57 dirInQuestion = path.split(
"/")[-1]
63 if line.split()[0][0] ==
"d":
64 if line.split()[8] == dirInQuestion:
def replaceByMap
— Helpers —############################