]> git.donarmstrong.com Git - lilypond.git/commitdiff
convert-ly: Handle malformed \version string (issue 2044).
authorJulien Rioux <jrioux@physics.utoronto.ca>
Sat, 21 Jan 2012 23:26:30 +0000 (18:26 -0500)
committerJulien Rioux <jrioux@physics.utoronto.ca>
Sat, 21 Jan 2012 23:53:20 +0000 (18:53 -0500)
scripts/convert-ly.py

index 9bf72876bf58327ebd67ffaede6dcd57906e399c..2772acc7382c144590cb73ca2da6c3db58603059 100644 (file)
@@ -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
@@ -206,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 ''