From 27ab4484f6a109758d0b5bc7194bfdeaa4abebaa Mon Sep 17 00:00:00 2001 From: Julien Rioux Date: Sat, 21 Jan 2012 18:26:30 -0500 Subject: [PATCH] convert-ly: Handle malformed \version string (issue 2044). --- scripts/convert-ly.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 9bf72876bf..2772acc738 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,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 '' -- 2.39.2