summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRobert Blake <blake14@llnl.gov>2020-08-13 23:42:53 -0700
committerGitHub <noreply@github.com>2020-08-14 08:42:53 +0200
commita9b1f22ba15ecfe290131f97f456fed060162568 (patch)
treefb969bb737c2b3a5e09122f58808d6cdaea25edb /var
parenta14648ffd0bfdb447a5aa7f996afee01454cf5e3 (diff)
downloadspack-a9b1f22ba15ecfe290131f97f456fed060162568.tar.gz
spack-a9b1f22ba15ecfe290131f97f456fed060162568.tar.bz2
spack-a9b1f22ba15ecfe290131f97f456fed060162568.tar.xz
spack-a9b1f22ba15ecfe290131f97f456fed060162568.zip
External package recognition for git. (#18010)
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/git/package.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py
index 8ecedd8c89..c8c0fef40a 100644
--- a/var/spack/repos/builtin/packages/git/package.py
+++ b/var/spack/repos/builtin/packages/git/package.py
@@ -4,6 +4,8 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import sys
+import re
+import os
from spack import *
@@ -16,6 +18,8 @@ class Git(AutotoolsPackage):
homepage = "http://git-scm.com"
url = "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.0.tar.gz"
+ executables = ['^git$']
+
# In order to add new versions here, add a new list entry with:
# * version: {version}
# * sha256: the sha256sum of the git-{version}.tar.gz
@@ -206,6 +210,22 @@ class Git(AutotoolsPackage):
depends_on('m4', type='build')
depends_on('tk', type=('build', 'link'), when='+tcltk')
+ @classmethod
+ def determine_version(cls, exe):
+ output = Executable(exe)('--version', output=str, error=str)
+ match = re.search(r'git version (\S+)', output)
+ return match.group(1) if match else None
+
+ @classmethod
+ def determine_variants(cls, exes, version_str):
+ prefix = os.path.dirname(exes[0])
+ variants = ''
+ if 'gitk' in os.listdir(prefix):
+ variants += '+tcltk'
+ else:
+ variants += '~tcltk'
+ return variants
+
# See the comment in setup_build_environment re EXTLIBS.
def patch(self):
filter_file(r'^EXTLIBS =$',