diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-02-11 18:44:57 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-02-11 18:44:57 +0100 |
commit | 53b59aa2cf78d465f471916c7fae60b9f212840b (patch) | |
tree | 5d18794de63923fc72603ecd5f0dff4c62380b61 /source4/scripting | |
parent | ddb4db7c65db202d71785a404622a4d6f1c3906a (diff) | |
download | samba-53b59aa2cf78d465f471916c7fae60b9f212840b.tar.gz samba-53b59aa2cf78d465f471916c7fae60b9f212840b.tar.bz2 samba-53b59aa2cf78d465f471916c7fae60b9f212840b.zip |
Use convenience function for finding setup_dir based on location of
python module.
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/provision.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 1d7011d305..d77b487512 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -45,6 +45,23 @@ from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError, \ __docformat__ = "restructuredText" + +def find_setup_dir(): + """Find the setup directory used by provision.""" + dirname = os.path.dirname(__file__) + if "/site-packages/" in dirname: + prefix = dirname[:dirname.index("/site-packages/")] + for suffix in ["share/setup", "share/samba/setup", "setup"]: + ret = os.path.join(prefix, suffix) + if os.path.isdir(ret): + return ret + # In source tree + ret = os.path.join(dirname, "../../../setup") + if os.path.isdir(ret): + return ret + raise Exception("Unable to find setup directory.") + + DEFAULTSITE = "Default-First-Site-Name" class InvalidNetbiosName(Exception): |