From 3648adc2a77c9ff56f218ec0c23d53a7c77fde73 Mon Sep 17 00:00:00 2001 From: Tom Scogland Date: Thu, 17 Mar 2022 02:54:29 -0700 Subject: python: allow versions with garbage suffix (#29543) * python: allow versions with garbage suffix Ubuntu 22.04 preview python prints version as 3.10.2+, the + causes version parsing to fail and breaks detection. * Add version comment * match VALID_VERSION regex --- var/spack/repos/builtin/packages/python/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index b7e0a27703..2ce0510819 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -271,8 +271,10 @@ class Python(AutotoolsPackage): # Python 2 sends to STDERR, while Python 3 sends to STDOUT # Output looks like: # Python 3.7.7 + # On pre-production Ubuntu, this is also possible: + # Python 3.10.2+ output = Executable(exe)('-V', output=str, error=str) - match = re.search(r'Python\s+(\S+)', output) + match = re.search(r'Python\s+([A-Za-z0-9_.-]+)', output) return match.group(1) if match else None @classmethod -- cgit v1.2.3-70-g09d2