示例#1
0
def output_file(msg, output_dir, pkg_name):
    file_path = os.path.join(output_dir, msg + 'Handler.cs')
    file_util.del_file(file_path)
    file_util.make_dir(file_util.file_dir(file_path))

    try:
        fp = open(file_path, 'wb')

        output_file_content(fp, msg, pkg_name)
        fp.close()

        print('=== generate %s done ===' % file_path)
    except Exception as e:
        print('exception: %s' % e)
        return -1

    return 0
示例#2
0
def output_header_file(msg, output_dir, namespace_list):
    for namespace in namespace_list:
        file_path = os.path.join(output_dir, namespace, name_style_util.camel_to_underline(msg).lower() + '_handler.h')
        file_util.del_file(file_path)
        file_util.make_dir(file_util.file_dir(file_path))

        try:
            fp = open(file_path, 'wb')

            output_header_file_content(fp, msg, namespace)
            fp.close()

            print('=== generate %s done ===' % file_path)
        except Exception as e:
            print('exception: %s' % e)
            return -1

    return 0
示例#3
0
def output_file(msg, output_dir, pkg_name, namespace_list):
    for namespace in namespace_list:
        if 'http' == namespace:
            continue

        file_path = os.path.join(
            output_dir, namespace,
            name_style_util.camel_to_underline(msg).lower().replace(
                '_req', '') + '_test.py')
        file_util.del_file(file_path)
        file_util.make_dir(file_util.file_dir(file_path))

        try:
            fp = open(file_path, 'wb')

            output_file_content(fp, msg, pkg_name, namespace)
            fp.close()

            print('=== generate %s done ===' % file_path)
        except Exception as e:
            print('exception: %s' % e)
            return -1

    return 0