lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

convert-ly: Handle malformed \version string (issue 2044). (issue 556304


From: julien . rioux
Subject: convert-ly: Handle malformed \version string (issue 2044). (issue 5563047)
Date: Sat, 21 Jan 2012 23:28:07 +0000

Reviewers: ,

Message:
Simple patch to issue a warning when the \version string is malformed.

Description:
convert-ly: Handle malformed \version string (issue 2044).

Please review this at http://codereview.appspot.com/5563047/

Affected files:
  M scripts/convert-ly.py


Index: scripts/convert-ly.py
diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py
index 9bf72876bf58327ebd67ffaede6dcd57906e399c..73073a33ba78f7a291ba1514ce42680b09965d52 100644
--- a/scripts/convert-ly.py
+++ b/scripts/convert-ly.py
@@ -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,11 +208,13 @@ 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)
-    else:
-        return ''
+    m = lilypond_version_re.search (input)
+    if m:
+        ly.warning (_ ("Malformed version string:") + m.group (1))
+    return ''

 class FatalConversionError (Exception):
     pass





reply via email to

[Prev in Thread] Current Thread [Next in Thread]