summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorTom Scogland <scogland1@llnl.gov>2022-03-17 02:54:29 -0700
committerGitHub <noreply@github.com>2022-03-17 03:54:29 -0600
commit3648adc2a77c9ff56f218ec0c23d53a7c77fde73 (patch)
tree3cdd5a631b1ee1c90128fdd7e7697b1a001420ab /var
parent4ef534b19babe55fa3f22b9356aaeda2cc1c4920 (diff)
downloadspack-3648adc2a77c9ff56f218ec0c23d53a7c77fde73.tar.gz
spack-3648adc2a77c9ff56f218ec0c23d53a7c77fde73.tar.bz2
spack-3648adc2a77c9ff56f218ec0c23d53a7c77fde73.tar.xz
spack-3648adc2a77c9ff56f218ec0c23d53a7c77fde73.zip
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
Diffstat (limited to 'var')
-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