コード例 #1
0
def build_all(file_data, output=None):
    input = clean_json(json.loads(file_data.decode('ascii', 'ignore')))
    validation_warnings, validation_errors = validate_spec(input)
    build_data = ""
    build_errors = []
    if not validation_errors:
        new_package = compile_spec(input)
        files = {}
        files.update(build_python(to_dict(new_package)))
        files.update(build_java(to_dict(new_package)))
        files.update(build_racket(to_dict(new_package)))
        if output is None:
            build_data, build_errors = build_zip(files)
        else:
            build_data, build_errors = build_dir(files, output)
    return validation_warnings, validation_errors, build_data, build_errors
コード例 #2
0
ファイル: build_all.py プロジェクト: RealTimeWeb/datasets
def build_all(file_data, output=None):
    input = clean_json(json.loads(file_data.decode('ascii', 'ignore')))
    validation_warnings, validation_errors = validate_spec(input)
    build_data = ""
    build_errors = []
    if not validation_errors:
        new_package = compile_spec(input)
        files = {}
        files.update(build_python(to_dict(new_package)))
        files.update(build_java(to_dict(new_package)))
        files.update(build_racket(to_dict(new_package)))
        if output is None:
            build_data, build_errors = build_zip(files)
        else:
            build_data, build_errors = build_dir(files, output)
    return validation_warnings, validation_errors, build_data, build_errors
コード例 #3
0
    if not fast:
        new_file, database_file = build_database(model)
        sql_file = name+".sql"
        build_locals(model, database_file, sql_file)
        database_file.close()
        moves = {new_file: new_folder, sql_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}
    
    return files, moves
    
if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_sql(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #4
0
ファイル: java.py プロジェクト: zeyadhisham/datasets

def build_java(model):
    files = {
        'java/libs/StickyWeb-doc-2.5.jar':
        copy_file(templates + 'libs/StickyWeb-doc-2.5.jar')
    }
    files.update(build_metafiles(model))
    files.update(build_main(model))
    files.update(build_classes(model))
    return files


if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1], 'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print "Warning!", warning
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_java(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print "Error!", error
コード例 #5
0
ファイル: builder.py プロジェクト: zeyadhisham/datasets
 with open(a_spec, 'r') as specification_file:
     specification = yaml.load(specification_file)
     # pprint(specification)
     compiled, warnings, errors = Compiler(a_spec, specification).run()
     # print("*"*10)
     if warnings:
         print("\tWarnings!")
         for warning in warnings:
             print("\t\t", warning)
     if errors:
         print("\tErrors!")
         for error in errors:
             print("\t\t", error)
     # print("*"*10)
     language_target = args.language.lower()
     compiled_dict = to_dict(compiled)
     
     #
     # Target Builder Dispatcher
     #
     if language_target == "python":
         files, moves = build_python(compiled_dict, args.fast)
     elif language_target == "csv":
         files, moves = build_csv(compiled_dict)
     elif language_target == "json":
         files, moves = build_json(compiled_dict)
     elif language_target == "racket":
         files, moves = build_racket(compiled_dict, args.fast)
     elif language_target == "java":
         files, moves = build_java(compiled_dict, args.fast)
     elif language_target == "sql":
コード例 #6
0
ファイル: build_python.py プロジェクト: mmehedin/datasets
    if not fast:
        new_file, database_file = build_database(model)
        build_locals(model, database_file)
        
        database_file.close()
        moves = {new_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}
    
    return files, moves
    
if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print "Warning!", warning
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_python(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print "Error!", error
コード例 #7
0
        with open(splash_file, 'rb') as splash_data:
            files[new_folder+name+"_splash.png"] = splash_data.read()
    else:
        model["metadata"]["splash"] = False
    
    if not fast:
        moves = {f: new_folder for f in build_locals(model, new_folder)}
    else:
        moves = {}
        
    files.update(build_metafiles(model))
    
    return files, moves
    
if __name__ == "__main__":
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_visualizer(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #8
0
ファイル: builder.py プロジェクト: mmehedin/datasets
 if args.all:
     args.spec = glob.glob(args.spec+'*.corgis')
 else:
     args.spec = [args.spec]
 
 if len(args.spec) > 1 and progressbar is not None:
     pbar = progressbar.ProgressBar(widgets=[progressbar.ReverseBar('<'),
        ' ', progressbar.Percentage(), ' ', progressbar.ETA()]).start()
 else:
     pbar = list
 for a_spec in pbar(args.spec):
     print a_spec
     with open(a_spec, 'r') as specification_file:
         specification = yaml.load(specification_file)
         #pprint(specification)
         compiled, warnings, errors = Compiler(a_spec, specification).run()
         #print("*"*10)
         if warnings: print "\tWarnings!"
         for warning in warnings:
             print "\t\t", warning
         if errors: print "\tErrors!"
         for error in errors:
             print "\t\t", error
         #print("*"*10)
         pprint(to_dict(compiled))
         if args.language.lower() == "python":
             files, moves = build_python(to_dict(compiled), args.fast)
             build_data, build_errors = build_dir(files, moves, args.target)
         elif args.language.lower() == "csv":
             files, moves = build_csv(to_dict(compiled))
             build_data, build_errors = build_dir(files, moves, args.target)
コード例 #9
0
ファイル: build_racket.py プロジェクト: zeyadhisham/datasets
    if not fast:
        new_file, database_file = build_database(model)
        build_locals(model, database_file)
        
        database_file.close()
        moves = {new_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}
    
    return files, moves
    
if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_racket(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #10
0
    full_key_descriptions = [i[4] for i in results]

    tifa_definitions = []
    for interface, s in zip(model['interfaces'], results):
        tifa_definitions.append(
            (interface['name'], TifaDefinition(s[5]).result))

    files.update(
        build_metafiles(model, key_names, indexes, full_key_descriptions,
                        tifa_definitions))

    return files, moves


if __name__ == "__main__":
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1], 'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_blockpy(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #11
0
ファイル: build_java.py プロジェクト: RealTimeWeb/datasets
    return files
                
def copy_file(filename):
    with open(filename, 'rb') as input:
        return input.read()

def build_java(model):
    files = {'java/libs/StickyWeb-doc-2.5.jar' : copy_file(templates+'libs/StickyWeb-doc-2.5.jar')}
    files.update(build_metafiles(model))
    files.update(build_main(model))
    files.update(build_classes(model))
    return files
    
if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print "Warning!", warning
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_java(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print "Error!", error
コード例 #12
0
ファイル: build_python.py プロジェクト: zeyadhisham/datasets
        new_file, database_file = build_database(model)
        build_locals(model, database_file)

        database_file.close()
        moves = {new_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}

    return files, moves


if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1], 'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_python(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #13
0
ファイル: build_sql.py プロジェクト: RealTimeWeb/datasets
    if not fast:
        new_file, database_file = build_database(model)
        sql_file = name+".sql"
        build_locals(model, database_file, sql_file)
        database_file.close()
        moves = {new_file: new_folder, sql_file: new_folder}
        for appendix in model['metadata']['appendix']:
            moves[appendix['file']] = new_folder
    else:
        moves = {}
    
    return files, moves
    
if __name__ == "__main__":
    import json
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_sql(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)
コード例 #14
0
ファイル: build_blockpy.py プロジェクト: RealTimeWeb/datasets
            files[new_folder+name+'.png'] = icon_data.read()
    else:
        model["metadata"]["icon"] = False
    
    results = list(build_locals(model, new_folder))
    moves = {f: new_folder for f in first_items(results)}
    key_names = [k for s in results for k in s[1]]
    indexes = {k:v for s in results for k, v in s[2].items()}
    full_key_descriptions = [i[3] for i in results]
        
    files.update(build_metafiles(model, key_names, indexes, full_key_descriptions))
    
    return files, moves
    
if __name__ == "__main__":
    from auxiliary import clean_json
    input = clean_json(json.load(open(sys.argv[1],'r')))
    from validate import validate_spec
    warnings, errors = validate_spec(input)
    for warning in warnings:
        print("Warning!", warning)
    if not errors:
        from compile import compile_spec
        new_package = compile_spec(input)
        files = build_blockpy(to_dict(new_package))
        from build import build_dir
        build_dir(files, sys.argv[2])
    else:
        for error in errors:
            print("Error!", error)