# HG changeset patch # User Gary Benson # Date 1276249043 -3600 # Node ID 67c6131e5d3d17cb96fbdf7aae879696cb4baac0 # Parent c907d4c3cc7b7265a41c8c13759e2d2c0e7a9f20 Fix up copyrights and stuff diff -r c907d4c3cc7b -r 67c6131e5d3d copyfix.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/copyfix.py Fri Jun 11 10:37:23 2010 +0100 @@ -0,0 +1,39 @@ +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))