diff options
Diffstat (limited to 'source4/scripting')
-rwxr-xr-x | source4/scripting/bin/samba_dnsupdate | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/__init__.py | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate index 8a7b8a4e34..b3956aa2c4 100755 --- a/source4/scripting/bin/samba_dnsupdate +++ b/source4/scripting/bin/samba_dnsupdate @@ -38,7 +38,7 @@ from samba import glue from samba.auth import system_session from samba.samdb import SamDB -samba.ensure_external_module("dns.resolver", "dnspython") +samba.ensure_external_module("dns", "dnspython") import dns.resolver as resolver default_ttl = 900 diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 87753b5a1d..50ecde2829 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -402,10 +402,15 @@ def ensure_external_module(modulename, location): try: __import__(modulename) except ImportError: - sys.path.insert(0, - os.path.join(os.path.dirname(__file__), - "../../../../lib", location)) - __import__(modulename) + import sys + if _in_source_tree(): + sys.path.insert(0, + os.path.join(os.path.dirname(__file__), + "../../../../lib", location)) + __import__(modulename) + else: + sys.modules[modulename] = __import__( + "samba.external.%s" % modulename, fromlist=["samba.external"]) version = glue.version |