summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/external.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-03-29 16:08:11 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-03-29 18:05:29 +0200
commit4bbc3ff037026c72f3249f59c1b5af69a6ad6d69 (patch)
tree125857a1edbf3246579e51b10f6e62ec875062bc /source4/scripting/python/samba/external.py
parent89aa3b766b926d19dac4805a7e72433e497ce872 (diff)
downloadsamba-4bbc3ff037026c72f3249f59c1b5af69a6ad6d69.tar.gz
samba-4bbc3ff037026c72f3249f59c1b5af69a6ad6d69.tar.xz
samba-4bbc3ff037026c72f3249f59c1b5af69a6ad6d69.zip
s4-python: Move dnspython to lib/, like the other Python modules
This also avoids it from being installed if it's already present on the system.
Diffstat (limited to 'source4/scripting/python/samba/external.py')
-rw-r--r--source4/scripting/python/samba/external.py27
1 files changed, 4 insertions, 23 deletions
diff --git a/source4/scripting/python/samba/external.py b/source4/scripting/python/samba/external.py
index eca910b794..40d13fd7e5 100644
--- a/source4/scripting/python/samba/external.py
+++ b/source4/scripting/python/samba/external.py
@@ -17,34 +17,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import sys, os
+import os, sys
-def samba_find_external(directory):
- '''insert into out module search path the path to an
- external library'''
- for p in sys.path:
- dir = os.path.join(p, directory)
- if os.path.isdir(dir):
- sys.path.insert(0, dir)
- return
-
- # finally try in the local directory, to handle in-tree testing
- dir = os.path.join("scripting/python", directory)
- if os.path.isdir(dir):
- sys.path.insert(0, dir)
- return
-
- print "Failed to find external python library %s" % directory
- raise
-
-
-def samba_external_dns_resolver():
+def dns_resolver():
'''try and import the dns.resolver library, and if it fails
then use a local copy from the external directory'''
try:
import dns.resolver as dns
- except:
- samba_find_external("samba_external/dnspython")
+ except ImportError:
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../../../lib/dnspython"))
import dns.resolver as dns
return dns