コード例 #1
0
def main():
    if (commit):
        p4commands.checkoutallfiles()
    for path,file_name in files_to_fix:
        full_file_name = path + file_name
        if (not commit):
            print full_file_name + ' will be edited'
            continue
        for line in fileinput.input(full_file_name, inplace=True):
            line = line.replace('\t',' '*TABSIZE);    # replace TABs
            line = line.rstrip(None)  # remove trailing whitespaces
            print line                # modify the file
    if (commit):
        p4commands.revertunchangedfiles()
コード例 #2
0
ファイル: trimall.py プロジェクト: lihuan545890/webrtc_old
def main():
    if (commit):
        p4commands.checkoutallfiles()
    for path, file_name in files_to_fix:
        full_file_name = path + file_name
        if (not commit):
            print full_file_name + ' will be edited'
            continue
        for line in fileinput.input(full_file_name, inplace=True):
            line = line.replace('\t', ' ' * TABSIZE)
            # replace TABs
            line = line.rstrip(None)  # remove trailing whitespaces
            print line  # modify the file
    if (commit):
        p4commands.revertunchangedfiles()
コード例 #3
0
ファイル: fixnames.py プロジェクト: lihuan545890/webrtc_old
    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)


def replaceall(my_table, extension_list):
    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]
        new_name = new_name
        for extension in extensions_to_edit:
            filemanagement.replacestringinallsubfolders(
                old_name, new_name, extension)
        print 100 * (size_of_table + index) / (size_of_table * 2)


if (commit):
    print 'commiting'
    replace_table = stringmanipulation.removenochange(replace_table)
    p4commands.checkoutallfiles()
    replaceoriginal(directory, replace_table)
    replaceall(replace_table, extensions_to_edit)
    p4commands.revertunchangedfiles()
else:
    for old_name, new_name in replace_table:
        print 'Going to replace [' + old_name + '] with [' + new_name + ']'
コード例 #4
0
        new_file_name = filename

        new_file_name = stringmanipulation.removeallprefix(new_file_name,\
                                                       'gips')
        new_file_name = stringmanipulation.removealloccurances(new_file_name,\
                                                       'module')
        new_file_name = stringmanipulation.changeextension(new_file_name,\
                                           old_extension,\
                                           new_extension)
        new_file_name = stringmanipulation.fixabbreviations( new_file_name )
        new_file_name = stringmanipulation.lowercasewithunderscore(new_file_name)
    if(not commit):
        print 'File ' + filename + ' will be replaced with ' + new_file_name
        continue
    full_new_file_name = path_dir + new_file_name
    full_old_file_name = path_dir + filename
    if(full_new_file_name != full_old_file_name):
        p4commands.integratefile(full_old_file_name,full_new_file_name)
    else:
        print 'skipping ' + new_file_name + ' due to no change'
    for extension in extensions:
        print 'replacing ' + filename
        if (extension == ".gyp"):
            filemanagement.replacestringinallsubfolders(
                filename,new_file_name,extension)
        else:
            filemanagement.replacestringinallsubfolders(
                '\"' + filename + '\"', '\"' + new_file_name + '\"', extension)
if(commit):
    p4commands.revertunchangedfiles()