1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-14 12:59:07 +03:00

s4-python: Install external packages to a different directory but import into

the normal namespace when the system doesn't have it available.
This commit is contained in:
Jelmer Vernooij
2010-04-01 15:20:25 +02:00
parent 64c564291d
commit 84891b048d
3 changed files with 14 additions and 8 deletions

View File

@ -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