#! @BASH@
# note: dash does not work
-pytt '(Copyright|\(c\)|\(C\)|@copyright\{\})\s*2006' '\1 2006--2007' $(find . -mindepth 2 -type f | grep -Ev 'out/|out-scons|out-www/|.git/|.scon|#|~|' | grep -iv 'change')
-pytt '(Copyright|\(c\)|\(C\)|@copyright\{\})\s*([^-]*--)(200[0-6])' '\1 \2\062007' $(find . -mindepth 2 -type f | grep -Ev 'out/|out-scons|out-www/|.git/|.scon|#|~' | grep -iv 'change')
+pytt '(Copyright|\(c\)|\(C\)|@copyright\{\})\s*2007' '\1 2007--2008' $(find . -mindepth 2 -type f | grep -Ev 'out/|out-scons|out-www/|.git/|.scon|#|~' | grep -iv 'change')
+pytt '(Copyright|\(c\)|\(C\)|@copyright\{\})\s*([^-]*--)(200[0-7])' '\1 \2\062008' $(find . -mindepth 2 -type f | grep -Ev 'out/|out-scons|out-www/|.git/|.scon|#|~' | grep -iv 'change')
--- /dev/null
+#! @PYTHON@
+
+import os
+import re
+import sys
+
+frm = re.compile (sys.argv[1], re.MULTILINE)
+to = sys.argv[2]
+
+if not sys.argv[3:] or sys.argv[3] == '-':
+ sys.stdout.write (re.sub (frm, to, sys.stdin.read ()))
+for file in sys.argv[3:]:
+ s = open (file).read ()
+ name = os.path.basename (file)
+ base, ext = os.path.splitext (name)
+ t = re.sub (frm, to % locals (), s)
+ if s != t:
+ if 1:
+ os.system ('mv %(file)s %(file)s~~' % locals ())
+ h = open (file, "w")
+ h.write (t)
+ h.close ()
+ else:
+ sys.stdout.write (t)