Beispiel #1
0
    quit()

if ((len(sys.argv) == 3) and (sys.argv[2] != '--commit')):
    print 'parameters are: parent directory [--commit]'
    quit()

commit = (len(sys.argv) == 3)

directory = sys.argv[1]
occurances = []

trace_identifier = 'WEBRTC_TRACE('
extensions = ['.h', '.cc', '.c', '.cpp']
files_to_fix = []
for extension in extensions:
    files_to_fix.extend(filemanagement.listallfilesinfolder(directory,\
                                                       extension))


# This function identifies the begining of a trace statement
def istracebegining(line):
    return stringmanipulation.issubstring(line, trace_identifier) != -1


def endofstatement(line):
    return stringmanipulation.issubstring(line, ';') != -1


def removekeywordfound(line):
    return stringmanipulation.issubstring(line, trace_remove_key_word) != -1

directory = sys.argv[1];
if(not filemanagement.pathexist(directory)):
    print 'path ' + directory + ' does not exist'
    quit()

if((len(sys.argv) == 3) and (sys.argv[2] != '--commit')):
    print 'parameters are: parent directory extension new extension [--commit]'
    quit()

commit = False
if(len(sys.argv) == 3):
    commit = True

files_to_fix = []
for extension in extensions:
    files_to_fix.extend(filemanagement.listallfilesinfolder(directory,\
                                                       extension))

# Just steal the header from the template
def fileheaderasstring():
    template_file_name = 'license_template.txt'
    if (not filemanagement.fileexist(template_file_name)):
        print 'File ' + template_file_name + ' not found!'
        quit()
    template_file = open(template_file_name,'r')
    return_string = ''
    for line in template_file:
        return_string += line
    return return_string

# Just steal the header from the template
def fileheaderasarray():
    quit()

new_extension = sys.argv[3]
if(not stringmanipulation.isextension(new_extension)):
    print new_extension + ' is not a valid extension'
    quit()

if((len(sys.argv) == 5) and (sys.argv[4] != '--commit')):
    print 'parameters are: parent directory extension new extension [--commit]'
    quit()

commit = False
if(len(sys.argv) == 5):
    commit = True

files_to_integrate = filemanagement.listallfilesinfolder(directory,\
                                                         old_extension)

if(commit):
    p4commands.checkoutallfiles()
for index in range(len(files_to_integrate)):
    if(commit):
        print (100*index)/len(files_to_integrate)
    path_dir = files_to_integrate[index][0]
    filename = files_to_integrate[index][1]
    is_ignore = False
    for ignore_names in ignore_these:
        if(filename == ignore_names):
            is_ignore = True
            break
    if(is_ignore):
        continue
Beispiel #4
0
if ((len(sys.argv) == 3) and (sys.argv[2] != '--commit')):
    print 'parameters are: parent directory [--commit]'
    quit()

commit = (len(sys.argv) == 3)

directory = sys.argv[1]
if (not filemanagement.pathexist(directory)):
    print 'path ' + directory + ' does not exist'
    quit()

# APIs are all in h-files
extension = '.h'

# All h-files
files_to_modify = filemanagement.listallfilesinfolder(directory,\
                                                      extension)


def isinmanualremovetable(compare_word):
    for old_word, new_word in manual_replace_table:
        if (old_word == compare_word):
            return True
    return False


# Begin
# This function looks at each line and decides which words should be replaced
# that is this is the only part of the script that you will ever want to change!
def findstringstoreplace(line):
    original_line = line
    # Dont replace compiler directives
if((len(sys.argv) == 3) and (sys.argv[2] != '--commit')):
    print 'parameters are: parent directory [--commit]'
    quit()

commit = (len(sys.argv) == 3)

directory = sys.argv[1];
if(not filemanagement.pathexist(directory)):
    print 'path ' + directory + ' does not exist'
    quit()

# APIs are all in h-files
extension = '.h'

# All h-files
files_to_modify = filemanagement.listallfilesinfolder(directory,\
                                                      extension)

def isinmanualremovetable( compare_word ):
    for old_word, new_word in manual_replace_table:
        if(old_word == compare_word):
            return True
    return False

# Begin
# This function looks at each line and decides which words should be replaced
# that is this is the only part of the script that you will ever want to change!
def findstringstoreplace(line):
    original_line = line
# Dont replace compiler directives
    if(line[0] == '#'):
        return []