summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/config.mk4
-rw-r--r--source4/scripting/python/samba/__init__.py9
2 files changed, 13 insertions, 0 deletions
diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk
index 9d972f7ee0..cf17a28a70 100644
--- a/source4/scripting/python/config.mk
+++ b/source4/scripting/python/config.mk
@@ -25,3 +25,7 @@ PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py
pydoctor:: pythonmods
LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --make-html --docformat=restructuredtext --add-package scripting/python/samba/ $(addprefix --add-module , $(PYDOCTOR_MODULES))
+
+clean::
+ @echo "Removing python modules"
+ @rm -f bin/python/*
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index 00b82e1800..2c51440b0c 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -21,6 +21,15 @@
import os
from misc import ldb_set_credentials
+def _in_source_tree():
+ print os.path.exists("%s/../../../samba4-skip" % os.path.dirname(__file__))
+
+# When running, in-tree, make sure bin/python is in the PYTHONPATH
+if _in_source_tree():
+ import sys
+ dir = os.path.dirname(__file__)
+ sys.path.append("%s/../../../bin/python" % os.path.dirname(__file__))
+
def Ldb(url, session_info=None, credentials=None, modules_dir=None):
"""Open a Samba Ldb file.