blob: cf18866b95f26aacb5676fec1b756d861a8905b3 [file] [log] [blame]
Guido van Rossumfc058821996-11-27 19:41:55 +00001#! /usr/bin/env python
2
3OLD_NOTICE = """
4Permission to use, copy, modify, and distribute this software and its
5documentation for any purpose and without fee is hereby granted,
6provided that the above copyright notice appear in all copies and that
7both that copyright notice and this permission notice appear in
8supporting documentation, and that the names of Stichting Mathematisch
9Centrum or CWI not be used in advertising or publicity pertaining to
10distribution of the software without specific, written prior permission.
11
12STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
13THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
14FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
15FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19"""
20
21NEW_NOTICE = """
Guido van Rossumfd71b9e2000-06-30 23:50:40 +000022Copyright (c) 2000, BeOpen.com.
23Copyright (c) 1995-2000, Corporation for National Research Initiatives.
24Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
25All rights reserved.
Guido van Rossumfc058821996-11-27 19:41:55 +000026
Guido van Rossumfd71b9e2000-06-30 23:50:40 +000027See the file "Misc/COPYRIGHT" for information on usage and
28redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Guido van Rossumfc058821996-11-27 19:41:55 +000029"""
30
31# " <-- Help Emacs
32
33import os, sys, string
34
35def main():
36 args = sys.argv[1:]
37 if not args:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000038 print "No arguments."
Guido van Rossumfc058821996-11-27 19:41:55 +000039 for arg in args:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000040 process(arg)
Guido van Rossumfc058821996-11-27 19:41:55 +000041
42def process(arg):
43 f = open(arg)
44 data = f.read()
45 f.close()
46 i = string.find(data, OLD_NOTICE)
47 if i < 0:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000048## print "No old notice in", arg
49 return
Guido van Rossumfc058821996-11-27 19:41:55 +000050 data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):]
51 new = arg + ".new"
52 backup = arg + ".bak"
53 print "Replacing notice in", arg, "...",
54 sys.stdout.flush()
55 f = open(new, "w")
56 f.write(data)
57 f.close()
58 os.rename(arg, backup)
59 os.rename(new, arg)
60 print "done"
61
62if __name__ == '__main__':
63 main()