]> git.donarmstrong.com Git - lilypond.git/commitdiff
Update grand-replace for 2008. Add missing pytt.
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 1 Dec 2008 20:44:31 +0000 (21:44 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Mon, 1 Dec 2008 20:55:22 +0000 (21:55 +0100)
buildscripts/grand-replace.sh
buildscripts/pytt.py [new file with mode: 0644]

index 1eec4484939de9ec60b9132ad70e1a7eb8dc7357..645eae6ea86ac3ca59775910df65d9cd0e6e1eee 100644 (file)
@@ -1,5 +1,5 @@
 #! @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')
diff --git a/buildscripts/pytt.py b/buildscripts/pytt.py
new file mode 100644 (file)
index 0000000..1026c02
--- /dev/null
@@ -0,0 +1,24 @@
+#! @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)