def copy_result_list(sque, dque): while True: if (len(sque) == 0 or len(dque) == 0): break src = sque.popleft() dst = dque.popleft() util.print_V(src + " => " + dst + "\n") copy_(src, dst) util.print_D(src + " => " + dst)
def copy_result_list(sque, dque): while True: if len(sque) == 0 or len(dque) == 0: break src = sque.popleft() dst = dque.popleft() util.print_V(src + " => " + dst + "\n") copy_(src, dst) util.print_D(src + " => " + dst)
def compile_code(workspace, debug=False): if os.path.isdir(workspace): pre_dir = os.getcwd() os.chdir(workspace) print os.getcwd() print "编译准备。" if not os.path.isdir("../log"): os.mkdir("../log") logFile = open(os.path.join("../log", str(time.time()) + ".log"), "w") print "删除上次的编译结果。" (status, output) = commands.getstatusoutput("ant clean") logFile.writelines(output) logFile.writelines("\n\n========== ant clean finish! ==========\n\n") if status == 0: print "删除成功。开始编译。Log信息查看文件:%s" % os.path.abspath(logFile.name) else: print output util.print_E("删除失败,退出编译。Log信息查看文件:%s" % os.path.abspath(logFile.name)) logFile.close() sys.exit(-1) if debug: util.print_V("ant debug") (status, output) = commands.getstatusoutput("ant debug") else: util.print_V("ant release") (status, output) = commands.getstatusoutput("ant release") logFile.writelines(output) logFile.writelines("\n\n========== ant release finish! ==========\n") if status == 0: print "编译成功。Log信息查看文件:%s" % os.path.abspath(logFile.name) else: print output util.print_E("编译失败。Log信息查看文件:%s" % os.path.abspath(logFile.name)) sys.exit(-1) logFile.close() os.chdir(pre_dir) else: util.print_E("error: 配置信息错误,目录 %s 不存在" % workspace) sys.exit(-1)