summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-01-08 17:24:07 +0100
committerEli Schwartz <eschwartz93@gmail.com>2025-01-08 13:45:40 -0500
commit27028bd3b173539fd93eed880ad31a73fc7d1719 (patch)
tree2524da6f050a6b08d9f743a8cd3ac1f67a72410f
parent5af3d3df0034d7ec3c159cc31f063558d5369df3 (diff)
downloadmeson-27028bd3b173539fd93eed880ad31a73fc7d1719.tar.gz
programs: fix regex to match multi-digit major version
In a3679a64e (programs: favor version numbers with dots, 2025-01-03) we have changed the regex used to extract version numbers to favor dotted versions. It was reported though that the regex doesn't match major version numbers that start with multiple digits correctly. Fix this. Signed-off-by: Patrick Steinhardt <ps@pks.im>
-rw-r--r--mesonbuild/programs.py2
-rw-r--r--unittests/internaltests.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/programs.py b/mesonbuild/programs.py
index 7f4cec52d..d01440cce 100644
--- a/mesonbuild/programs.py
+++ b/mesonbuild/programs.py
@@ -123,7 +123,7 @@ class ExternalProgram(mesonlib.HoldableObject):
if not output:
output = e.strip()
- match = re.search(r'([0-9](\.[0-9]+)+)', output)
+ match = re.search(r'([0-9]+(\.[0-9]+)+)', output)
if not match:
match = re.search(r'([0-9][0-9\.]+)', output)
if not match:
diff --git a/unittests/internaltests.py b/unittests/internaltests.py
index 363541049..d7994ee08 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -689,6 +689,7 @@ class InternalTests(unittest.TestCase):
'foo 1.2.4.': '1.2.4',
'foo 1.2.4': '1.2.4',
'foo 1.2.4 bar': '1.2.4',
+ 'foo 10.0.0': '10.0.0',
'50 5.4.0': '5.4.0',
'This is perl 5, version 40, subversion 0 (v5.40.0)': '5.40.0',
'git version 2.48.0.rc1': '2.48.0',