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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user