Bump version to 0.9.1.
[python/dscho.git] / Tools / scripts / fixnotice.py
blobcf18866b95f26aacb5676fec1b756d861a8905b3
1 #! /usr/bin/env python
3 OLD_NOTICE = """
4 Permission to use, copy, modify, and distribute this software and its
5 documentation for any purpose and without fee is hereby granted,
6 provided that the above copyright notice appear in all copies and that
7 both that copyright notice and this permission notice appear in
8 supporting documentation, and that the names of Stichting Mathematisch
9 Centrum or CWI not be used in advertising or publicity pertaining to
10 distribution of the software without specific, written prior permission.
12 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
13 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
14 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
15 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
18 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 """
21 NEW_NOTICE = """
22 Copyright (c) 2000, BeOpen.com.
23 Copyright (c) 1995-2000, Corporation for National Research Initiatives.
24 Copyright (c) 1990-1995, Stichting Mathematisch Centrum.
25 All rights reserved.
27 See the file "Misc/COPYRIGHT" for information on usage and
28 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
29 """
31 # " <-- Help Emacs
33 import os, sys, string
35 def main():
36 args = sys.argv[1:]
37 if not args:
38 print "No arguments."
39 for arg in args:
40 process(arg)
42 def process(arg):
43 f = open(arg)
44 data = f.read()
45 f.close()
46 i = string.find(data, OLD_NOTICE)
47 if i < 0:
48 ## print "No old notice in", arg
49 return
50 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"
62 if __name__ == '__main__':
63 main()