示例#1
0
                return False, check.target

    return True, ""


if __name__ == "__main__":
    #print(len(sys.argv))
    conf_file = "./pro_conf.xml"
    data_out = ""
    if len(sys.argv) > 1:
        conf_file = sys.argv[1]
    if len(sys.argv) > 2:
        data_out = sys.argv[2]
    print(conf_file)
    print(data_out)
    pconf, err = pro_conf.parse_pro_conf(conf_file)
    if pconf == None:
        print("pro_conf parse_pro_conf failed.")
        sys.exit(-1)

    # 替换数据输出目录
    if data_out != "":
        pconf.data_path = data_out

    oret, err = output(pconf)
    if oret != True:
        print("pro_conf output failed:" + err.get_err_msg())
        sys.exit(-1)

    print("pro_conf output ok.")
示例#2
0
                    field.value), field.desc)
            cstr += '};\n'
            cstr += '\n'
        cstr += '\n'
        #cstr += '#endif\n'
        try:
            fo = open(os.path.join(code_path, '%s.cs' % (k, )), 'w')
            fo.write(cstr)
            fo.close()
        except Exception as e:
            return False, 'write enum(%s) failed, %s' % (k, e.args)

    return True, ''


# 检查proconf中是否有target_name对应的file_entry定义
def check_target_name_in_file_list(target_name, file_list):
    for fen in file_list:
        if fen.target_name == target_name:
            return True
    return False


if __name__ == '__main__':
    pconf, err = pro_conf.parse_pro_conf("./pro_conf.xml")
    if pconf == None:
        print('pconf parsed failed, err:' + err)
        sys.exit(-1)

    output(pconf)