Mercurial > hg > shark
changeset 20:67c6131e5d3d
Fix up copyrights and stuff
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Fri, 11 Jun 2010 10:37:23 +0100 |
parents | c907d4c3cc7b |
children | 8c6cbd644b4f |
files | copyfix.py |
diffstat | 1 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /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))