summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/wafsamba/samba_git.py11
-rw-r--r--third_party/wscript4
2 files changed, 12 insertions, 3 deletions
diff --git a/buildtools/wafsamba/samba_git.py b/buildtools/wafsamba/samba_git.py
index d103aa8a60b..c58a57983d5 100644
--- a/buildtools/wafsamba/samba_git.py
+++ b/buildtools/wafsamba/samba_git.py
@@ -14,6 +14,15 @@ def find_git(env=None):
return None
+def has_submodules(path):
+ """Check whether a source directory is git-versioned and has submodules.
+
+ :param path: Path to Samba source directory
+ """
+ return (os.path.isdir(os.path.join(path, ".git")) and
+ os.path.isfile(os.path.join(path, ".gitmodules")))
+
+
def read_submodule_status(path, env=None):
"""Check status of submodules.
@@ -24,7 +33,7 @@ def read_submodule_status(path, env=None):
:raise RuntimeError: raised when parsing of 'git submodule status' output
fails.
"""
- if not os.path.isfile(os.path.join(path, ".gitmodules")):
+ if not has_submodules(path):
# No point in running git.
return
git = find_git(env)
diff --git a/third_party/wscript b/third_party/wscript
index d41b90698ed..d5b9df7bb96 100644
--- a/third_party/wscript
+++ b/third_party/wscript
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+import samba_git
import Utils
import os
import sys
@@ -27,8 +28,7 @@ def find_third_party_module(conf, module, package):
try:
__import__(module)
except ImportError:
- if (os.path.isdir(os.path.join(conf.srcdir, ".git")) and
- os.path.isfile(os.path.join(conf.srcdir, ".gitmodule"))):
+ if samba_git.has_submodules(conf.srcdir):
raise Utils.WafError("""\
Unable to find Python module '%s'. Please install the system package or check \
out the relevant submodule by running 'git submodule update --init'.