blob: cf6f140b8c1b535ff41f3b1312f5d3ed0b64acc6 [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 = """
22Permission to use, copy, modify, and distribute this software and its
23documentation for any purpose and without fee is hereby granted,
24provided that the above copyright notice appear in all copies and that
25both that copyright notice and this permission notice appear in
26supporting documentation, and that the names of Stichting Mathematisch
27Centrum or CWI or Corporation for National Research Initiatives or
28CNRI not be used in advertising or publicity pertaining to
29distribution of the software without specific, written prior
30permission.
31
32While CWI is the initial source for this software, a modified version
33is made available by the Corporation for National Research Initiatives
34(CNRI) at the Internet address ftp://ftp.python.org.
35
36STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
37REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
38MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
39CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
40DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
41PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
42TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
43PERFORMANCE OF THIS SOFTWARE.
44"""
45
46# " <-- Help Emacs
47
48import os, sys, string
49
50def main():
51 args = sys.argv[1:]
52 if not args:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000053 print "No arguments."
Guido van Rossumfc058821996-11-27 19:41:55 +000054 for arg in args:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000055 process(arg)
Guido van Rossumfc058821996-11-27 19:41:55 +000056
57def process(arg):
58 f = open(arg)
59 data = f.read()
60 f.close()
61 i = string.find(data, OLD_NOTICE)
62 if i < 0:
Guido van Rossumed5b3d81998-03-24 05:30:29 +000063## print "No old notice in", arg
64 return
Guido van Rossumfc058821996-11-27 19:41:55 +000065 data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):]
66 new = arg + ".new"
67 backup = arg + ".bak"
68 print "Replacing notice in", arg, "...",
69 sys.stdout.flush()
70 f = open(new, "w")
71 f.write(data)
72 f.close()
73 os.rename(arg, backup)
74 os.rename(new, arg)
75 print "done"
76
77if __name__ == '__main__':
78 main()