1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

Factor out function for finding Git binary.

Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jelmer Vernooij 2015-05-18 17:37:51 +00:00 committed by Andrew Bartlett
parent 8eda4efacd
commit 5d672b9a53
2 changed files with 19 additions and 6 deletions

View File

@ -0,0 +1,14 @@
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

View File

@ -1,17 +1,16 @@
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