summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/python/package.py4
1 files changed, 3 insertions, 1 deletions
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