Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
--- /dev/null
+import os
+
+def find_git(env=None):
+ """Find the git binary."""
+ if env is not None and 'GIT' in env:
+ return env['GIT']
+
+ # Get version from GIT
+ if os.path.exists("/usr/bin/git"):
+ # this is useful when doing make dist without configuring
+ return "/usr/bin/git"
+
+ return None
+
import os
import Utils
import samba_utils
-import sys
+from samba_git import find_git
def git_version_summary(path, env=None):
- # Get version from GIT
- if not 'GIT' in env and os.path.exists("/usr/bin/git"):
- # this is useful when doing make dist without configuring
- env.GIT = "/usr/bin/git"
+ git = find_git(env)
- if not 'GIT' in env:
+ if git is None:
return ("GIT-UNKNOWN", {})
+ env.GIT = git
+
environ = dict(os.environ)
environ["GIT_DIR"] = '%s/.git' % path
environ["GIT_WORK_TREE"] = path