Mercurial > hg > shark
changeset 22:3460f6c2fae8
Cleanup
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Thu, 10 Feb 2011 11:36:59 +0000 |
parents | 8c6cbd644b4f |
children | 65113b586fa5 |
files | copyfix.py |
diffstat | 1 files changed, 0 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- 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))