summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-19 13:41:48 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-19 13:41:48 +0200
commitf36a9afc2f62827700e4b8b441448aef00439f7d (patch)
treee15a1ab2bbb8a3cf911b6a999815d0c7a357798c /source4/scripting
parentbd1786f7f15d9fd6382979ff753fefc7a9cd0024 (diff)
downloadsamba-f36a9afc2f62827700e4b8b441448aef00439f7d.tar.gz
samba-f36a9afc2f62827700e4b8b441448aef00439f7d.tar.bz2
samba-f36a9afc2f62827700e4b8b441448aef00439f7d.zip
s4-python: Use sys.prefix rather than guessing prefix from current
file path.
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/provision.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index 7fa5dbbdd7..bfa1b952d4 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -64,14 +64,13 @@ __docformat__ = "restructuredText"
def find_setup_dir():
"""Find the setup directory used by provision."""
- dirname = os.path.dirname(__file__)
- if "/site-packages/" in dirname:
- prefix = "/".join(dirname[:dirname.index("/site-packages/")].split("/")[:-2])
- for suffix in ["share/setup", "share/samba/setup", "setup"]:
- ret = os.path.join(prefix, suffix)
- if os.path.isdir(ret):
- return ret
+ import sys
+ for suffix in ["share/setup", "share/samba/setup", "setup"]:
+ ret = os.path.join(sys.prefix, suffix)
+ if os.path.isdir(ret):
+ return ret
# In source tree
+ dirname = os.path.dirname(__file__)
ret = os.path.join(dirname, "../../../setup")
if os.path.isdir(ret):
return ret