From: Julien Rioux Date: Sat, 21 Jan 2012 23:26:30 +0000 (-0500) Subject: convert-ly: Handle malformed \version string (issue 2044). X-Git-Tag: release/2.15.27-1~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=27ab4484f6a109758d0b5bc7194bfdeaa4abebaa;p=lilypond.git convert-ly: Handle malformed \version string (issue 2044). --- 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 ''