Ejemplo n.º 1
0
def __check_apiwebmodule_meta_flag(file_path):
    comm_funcs.print_ok(
        "apiwebmodule ......begin __check_apiwebmodule_meta_flag:" + file_path)
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    print_ok("Done apiwebmodule")
    return True
    pass
Ejemplo n.º 2
0
def walk_dir_add_magic_tag_to_files(some_path, pattern = '*.go'):
    for root, dirs, files in os.walk(some_path):
        for filename in fnmatch.filter(files, pattern):
            if filename.startswith("."):
                print_error("invalid:" + one_filename )
                continue
            #check magic tag
            #if yes , continue
            #else read content then add tag 
            #backup original file and create new file
            file_path =  os.path.join(root, filename)
            if sub_gene_comm.check_is_go_file_have_meta_flag( file_path ):
                continue
            all_file_conent = ""
            contents_list = comm_funcs.get_file_content_as_list( file_path )
            all_original_code = ""
            line_num = 0
            for line in contents_list:
                if 0 == line_num:
                    line_num = line_num + 1
                    continue
                line_num = line_num + 1
                all_original_code = all_original_code + line
            all_file_conent = all_file_conent + contents_list[0] + "\n" 
            # add empty line
            all_file_conent = all_file_conent + "\n" 
            all_file_conent = all_file_conent + GoTemplateMagicSecondLine  + "\n"
            all_file_conent = all_file_conent + GoTemplateAutoPartBegin + "\n"
            all_file_conent = all_file_conent + GoTemplateAutoPartEnd  + "\n" 
            all_file_conent = all_file_conent + GoTemplateCustomPartBegin  + "\n"
            all_file_conent =  all_file_conent + all_original_code
            all_file_conent = all_file_conent + GoTemplateCustomPartEnd  + "\n"
            sub_gene_comm.backup_go_file_in_curr_dir_and_touch_new_one( file_path )
            comm_funcs.add_to_exist_file( file_path  , all_file_conent  )
Ejemplo n.º 3
0
def __check_funcs_meta_flag(file_path):
    comm_funcs.print_ok("......begin __check_funcs_meta_flag:" + file_path)
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    return True
Ejemplo n.º 4
0
def __check_model_meta_flag( file_path ):
    comm_funcs.print_ok("......begin __check_model_meta_flag:" + file_path)
    # if check failed then sys exit
    sub_gene_comm.check_is_go_file_have_meta_flag(file_path)
    return True