summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 =$',