summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2021-06-05 18:30:28 -0500
committerGitHub <noreply@github.com>2021-06-05 23:30:28 +0000
commit7449d6950a0e53c34668648a716c7ef0753acb7b (patch)
tree08057dbef93b3edfe34335f2b5d35f0afd0034a6 /lib
parent9f8e40e95c84409328ee94dc51150cbedf53316a (diff)
downloadspack-7449d6950a0e53c34668648a716c7ef0753acb7b.tar.gz
spack-7449d6950a0e53c34668648a716c7ef0753acb7b.tar.bz2
spack-7449d6950a0e53c34668648a716c7ef0753acb7b.tar.xz
spack-7449d6950a0e53c34668648a716c7ef0753acb7b.zip
Fix git_version on macOS (#24163)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/fetch_strategy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index f885980ccd..da0b12556f 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -780,8 +780,9 @@ class GitFetchStrategy(VCSFetchStrategy):
@property
def git_version(self):
- vstring = self.git('--version', output=str).lstrip('git version ')
- return Version(vstring)
+ output = self.git('--version', output=str, error=str)
+ match = re.search(r'git version (\S+)', output)
+ return Version(match.group(1)) if match else None
@property
def git(self):