1 from popen2 import Popen3
4 client = config.get_val("arch_client")
7 config.set_val("arch_client", client)
11 output = q.fromchild.read()
12 error = q.childerr.read()
14 if os.WIFEXITED(status):
15 return os.WEXITSTATUS(status), output, error
16 raise Exception("Command failed: %s" % error)
18 def invoke_client(*args, **kwargs):
21 status,output,error = invoke(cl_args)
22 if status not in (0,):
23 raise Exception("Command failed: %s" % error)
27 invoke_client("add-id", filename)
29 def delete_id(filename):
30 invoke_client("delete-id", filename)
36 def set_file_contents(path, contents):
37 add = not os.path.exists(path)
38 file(path, "wb").write(contents)
43 def path_in_reference(bug_dir, spec):
45 return invoke_client("file-find", bug_dir, spec).rstrip('\n')
46 return invoke_client("file-find", bug_dir).rstrip('\n')
59 """Detect whether a directory is revision-controlled using Arch"""
60 path = os.path.realpath(path)
62 if os.path.exists(os.path.join(path, "{arch}")):
66 path = os.path.dirname(path)