# HG changeset patch # User Gary Benson # Date 1297337819 0 # Node ID 3460f6c2fae8f6fba1ea565c6bb2250d93558e3c # Parent 8c6cbd644b4f6293a64d0a4816cdcb834b1f3a79 Cleanup diff -r 8c6cbd644b4f -r 3460f6c2fae8 copyfix.py --- a/copyfix.py Tue Jul 27 14:41:32 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -import os -import re - -oldcopy = re.compile( - r"Copyright\s+(.*)" + - r"\s+Sun\s+Microsystems,\s+Inc\.\s+All\s+Rights\s+Reserved\.") -newcopy = \ - "Copyright (c) %d, %d, Oracle and/or its affiliates. All rights reserved." - -oldaddr = ( - "Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,\n", - "CA 95054 USA or visit www.sun.com if you need additional information or\n", - "have any questions.\n") -newaddr = ( - "Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n", - "or visit www.oracle.com if you need additional information or have any\n", - "questions.\n") - -def process(path): - lines = open(path, "r").readlines() - for i, line in zip(xrange(len(lines)), lines): - match = oldcopy.search(line) - if match: - old = match.group(0) - new = newcopy % tuple(map(int, match.group(1).split("-"))) - lines[i] = line.replace(old, new) - continue - if line.endswith(oldaddr[0]): - for j, old, new in zip(xrange(len(oldaddr)), oldaddr, newaddr): - assert lines[i + j].endswith(old) - lines[i + j] = lines[i + j].replace(old, new) - continue - open(path, "w").write("".join(lines)) - -if __name__ == "__main__": - for root, dirs, files in os.walk("hotspot/src"): - for file in files: - if file.endswith("pp"): - process(os.path.join(root, file))