]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
Web: Revise Chinese translation in build scripts
[lilypond.git] / scripts / convert-ly.py
index 9f983540d6a2c4a1d3f7992d979bacd45dd36f68..2772acc7382c144590cb73ca2da6c3db58603059 100644 (file)
@@ -5,7 +5,7 @@
 
 # This file is part of LilyPond, the GNU music typesetter.
 #
-# Copyright (C) 1998--2011  Han-Wen Nienhuys <hanwen@xs4all.nl>
+# Copyright (C) 1998--2012  Han-Wen Nienhuys <hanwen@xs4all.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 #
 # LilyPond is free software: you can redistribute it and/or modify
@@ -39,6 +39,8 @@ import convertrules
 lilypond_version_re_str = '\\\\version *\"([0-9.]+)"'
 lilypond_version_re = re.compile (lilypond_version_re_str)
 
+lilypond_version_strict_re_str = '\\\\version *\"([0-9]+[.][0-9]+[.][0-9]+)"'
+lilypond_version_strict_re = re.compile (lilypond_version_strict_re_str)
 
 help_summary = (
 _ ('''Update LilyPond input to newer version.  By default, update from the
@@ -70,7 +72,7 @@ def warranty ():
 
 %s
 %s
-''' % ( _ ('Copyright (c) %s by') % '2001--2011',
+''' % ( _ ('Copyright (c) %s by') % '2001--2012',
         ' '.join (authors),
         _ ('Distributed under terms of the GNU General Public License.'),
         _ ('It comes with NO WARRANTY.')))
@@ -181,16 +183,18 @@ tuple (LAST,STR), with the last successful conversion and the resulting
 string."""
     conv_list = get_conversions (from_version, to_version)
 
-    ly.progress (_ ("Applying conversion: "))
+    ly.progress (_ ("Applying conversion: "), newline = False)
 
     last_conversion = ()
     try:
         if not conv_list:
             last_conversion = to_version
         for x in conv_list:
-            ly.progress (tup_to_str (x[0]))
             if x != conv_list[-1]:
-                ly.progress (', ')
+                ly.progress (tup_to_str (x[0]), newline = False)
+                ly.progress (', ', newline = False)
+            else:
+                ly.progress (tup_to_str (x[0]))
             str = x[1] (str)
             last_conversion = x[0]
 
@@ -204,9 +208,12 @@ string."""
 
 
 def guess_lilypond_version (input):
-    m = lilypond_version_re.search (input)
+    m = lilypond_version_strict_re.search (input)
     if m:
         return m.group (1)
+    m = lilypond_version_re.search (input)
+    if m:
+        raise InvalidVersion (m.group (1))
     else:
         return ''
 
@@ -344,6 +351,5 @@ def main ():
                          "Valid version strings consist of three numbers, "
                          "separated by dots, e.g. `2.8.12'") % (f, v.version) )
 
-    ly.progress ('\n')
 
 main ()