From: Jan Nieuwenhuizen Date: Mon, 1 Dec 2008 20:44:31 +0000 (+0100) Subject: Update grand-replace for 2008. Add missing pytt. X-Git-Tag: release/2.12.0-1~13^2~32^2~42 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=be793c61e9438ae1c7864b449a77e9ab0ce69e65;p=lilypond.git Update grand-replace for 2008. Add missing pytt. --- diff --git a/buildscripts/grand-replace.sh b/buildscripts/grand-replace.sh index 1eec448493..645eae6ea8 100644 --- a/buildscripts/grand-replace.sh +++ b/buildscripts/grand-replace.sh @@ -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 index 0000000000..1026c02bf7 --- /dev/null +++ b/buildscripts/pytt.py @@ -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)