1 from linda.debug import dprint
2 import os
3
5 pipe = os.popen('%s 2>/dev/null' % command)
6 output = pipe.read()
7 exitstat = pipe.close()
8 if exitstat is None:
9 exitstat = 0
10 if output[-1:] == '\n':
11 output = output[:-1]
12 if exitstat != 0 and not ignoreexit:
13 dprint(_("%s failed (%d): %s") % (command, exitstat, output))
14 raise ExtCmdException("%s exited with a status of %d" % (command, \
15 exitstat))
16 return output
17
20
22 tmp_file = []
23 os.path.walk(directory, add_file, tmp_file)
24 return tmp_file
25
27 for x in names:
28 if os.path.isfile(os.path.join(dirname, x)) or \
29 os.path.islink(os.path.join(dirname, x)):
30 arg.append(os.path.join(dirname, x))
31
33 if not path:
34 return []
35 if path[0] == '.':
36 path = path[1:]
37 split = list(os.path.split(path))
38 while True:
39 other_split = list(os.path.split(split[0]))
40 if other_split[0] == '/':
41 split = other_split[1:] + split[1:]
42 break
43 else:
44 split = other_split + split[1:]
45 return split
46