[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Thu Apr 1 07:33:26 MDT 2010


The branch, master has been updated
       via  c63440e... s4-python: Ensure __init__ exists in samba.external, or importing will fail.
       via  84891b0... s4-python: Install external packages to a different directory but import into the normal namespace when the system doesn't have it available.
      from  64c5642... s3: Fix a typo in winbindd_pam_logoff

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c63440e040798722288a530a64e59d19344c63ee
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 1 15:32:32 2010 +0200

    s4-python: Ensure __init__ exists in samba.external, or importing will fail.

commit 84891b048d577e52da91c64d310f7bafa115d015
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Thu Apr 1 15:20:25 2010 +0200

    s4-python: Install external packages to a different directory but import into
    the normal namespace when the system doesn't have it available.

-----------------------------------------------------------------------

Summary of changes:
 source4/script/installmisc.sh              |    8 +++++---
 source4/scripting/bin/samba_dnsupdate      |    2 +-
 source4/scripting/python/samba/__init__.py |   13 +++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/script/installmisc.sh b/source4/script/installmisc.sh
index 6a53b98..32a2ee4 100755
--- a/source4/script/installmisc.sh
+++ b/source4/script/installmisc.sh
@@ -83,12 +83,14 @@ cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1
 
 echo "Installing external python libraries"
 mkdir -p $DESTDIR$PYTHONDIR || exit 1
-for p in $($PYTHON scripting/python/samba_external/missing.py);
+MISSING="$($PYTHON scripting/python/samba_external/missing.py)"
+for p in $MISSING
 do
   package=`basename $p`
   echo "Installing missing python package $package"
-  mkdir -p $DESTDIR$PYTHONDIR/$package
-  cp -r ../lib/$p/* $DESTDIR$PYTHONDIR/$package/ || exit 1
+  mkdir -p $DESTDIR$PYTHONDIR/samba/external/$package
+  touch $DESTDIR$PYTHONDIR/samba/external/__init__.py
+  cp -r ../lib/$p/* $DESTDIR$PYTHONDIR/samba/external/$package/ || exit 1
 done
 
 echo "Installing stuff in $PRIVATEDIR"
diff --git a/source4/scripting/bin/samba_dnsupdate b/source4/scripting/bin/samba_dnsupdate
index 8a7b8a4..b3956aa 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 87753b5..50ecde2 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
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list