36 @param root_directory root directory within which to modify all files
39 for filepath
in filepaths:
42 ReportWarning(
'cannot find a parser for file %s, skipping...' %
46 comment_blocks = parser.FindAllCommentBlocks(old_file_contents)
47 if not comment_blocks:
50 old_copyright_block = parser.FindCopyrightBlock(comment_blocks)
51 if not old_copyright_block:
52 ReportWarning(
'cannot find copyright block in file %s' % filepath)
53 (year, holder) = parser.GetCopyrightBlockAttributes(old_copyright_block)
56 'unrecognized copyright holder "%s" in file %s, skipping...' % (
59 new_copyright_block = parser.CreateCopyrightBlock(year, holder)
60 if old_copyright_block:
61 new_file_contents = old_file_contents.replace(
62 old_copyright_block, new_copyright_block, 1)
64 new_file_contents = new_copyright_block + old_file_contents
ReadFileIntoString(filepath)
GetAllFilepaths(root_directory)
ConfirmAllowedCopyrightHolder(holder)
WriteStringToFile(string, filepath)