Пример #1
0
def replaceoriginal(path, my_table):
    size_of_table = len(my_table)
    for index in range(len(my_table)):
        old_name = my_table[index][0]
        new_name = my_table[index][1]
        filemanagement.replacestringinfolder(path, old_name, new_name,\
                                             ".h")
        print(100 * index) / (size_of_table * 2)
Пример #2
0
def replaceoriginal( path,my_table ):
    size_of_table = len(my_table)
    for index in range(len(my_table)):
        old_name = my_table[index][0]
        new_name = my_table[index][1]
        filemanagement.replacestringinfolder(path, old_name, new_name,\
                                             ".h")
        print (100*index) / (size_of_table*2)
        continue
    old_include_guard_set = findoldincludeguardset(path_dir,filename)
    if (len(old_include_guard_set) != 3) :
        failed_files.append('unable to figure out the include guards for ' + filename)
        continue

    new_include_guard_set = buildnewincludeguardset(path_dir,filename)
    if (len(new_include_guard_set) != 3) :
        failed_files.append('unable to figure out new the include guards for ' + filename)
        continue

    if(not commit):
        print 'old guard: ' + old_include_guard_set[2]
        print 'new guard: ' + new_include_guard_set[2]
        continue

    for index in range(2):
        # enough to only replace for file. However, no function for that
        for extension in extensions:
            filemanagement.replacestringinfolder(path_dir,old_include_guard_set[index],new_include_guard_set[index],extension)
    # special case for last to avoid complications
    for extension in extensions:
        filemanagement.replacestringinfolder(path_dir,' ' + old_include_guard_set[2],' ' + new_include_guard_set[2],extension)
        filemanagement.replacestringinfolder(path_dir,'\\/\\/' + old_include_guard_set[2],'\\/\\/ ' + new_include_guard_set[2],extension)


if(len(failed_files) > 0):
    print 'Following failures should be investigated manually:'
for line in failed_files:
    print line
Пример #4
0
    new_include_guard_set = buildnewincludeguardset(path_dir, filename)
    if (len(new_include_guard_set) != 3):
        failed_files.append(
            'unable to figure out new the include guards for ' + filename)
        continue

    if (not commit):
        print 'old guard: ' + old_include_guard_set[2]
        print 'new guard: ' + new_include_guard_set[2]
        continue

    for index in range(2):
        # enough to only replace for file. However, no function for that
        for extension in extensions:
            filemanagement.replacestringinfolder(path_dir,
                                                 old_include_guard_set[index],
                                                 new_include_guard_set[index],
                                                 extension)
    # special case for last to avoid complications
    for extension in extensions:
        filemanagement.replacestringinfolder(path_dir,
                                             ' ' + old_include_guard_set[2],
                                             ' ' + new_include_guard_set[2],
                                             extension)
        filemanagement.replacestringinfolder(
            path_dir, '\\/\\/' + old_include_guard_set[2],
            '\\/\\/ ' + new_include_guard_set[2], extension)

if (len(failed_files) > 0):
    print 'Following failures should be investigated manually:'
for line in failed_files:
    print line