diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-11-03 19:13:03 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-11-03 19:13:36 +0000 |
commit | 6bd903ebe09f79431ff10bfaf5c7769c8a79e133 (patch) | |
tree | 38f37cd87659ab8b568ea0866ff87c8bd1b348e7 /source4/scripting/python | |
parent | 654fdce6a2b67c739675fb29c5072ca676ac00a7 (diff) | |
download | samba-6bd903ebe09f79431ff10bfaf5c7769c8a79e133.tar.gz samba-6bd903ebe09f79431ff10bfaf5c7769c8a79e133.tar.bz2 samba-6bd903ebe09f79431ff10bfaf5c7769c8a79e133.zip |
provision: Look for in source setup data first, in case an older version
of samba 4 is installed in the system.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/provision.py | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 7c38197bec..ce3fa17766 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -41,9 +41,21 @@ import ldb from samba.auth import system_session, admin_session import samba -from samba import version, Ldb, substitute_var, valid_netbios_name -from samba import check_all_substituted, read_and_sub_file, setup_file -from samba.dsdb import DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008_R2, ENC_ALL_TYPES +from samba import ( + Ldb, + check_all_substituted, + in_source_tree, + read_and_sub_file, + setup_file, + substitute_var, + valid_netbios_name, + version, + ) +from samba.dsdb import ( + DS_DOMAIN_FUNCTION_2003, + DS_DOMAIN_FUNCTION_2008_R2, + ENC_ALL_TYPES, + ) from samba.dcerpc import security from samba.dcerpc.misc import SEC_CHAN_BDC, SEC_CHAN_WKSTA from samba.idmap import IDmapDB @@ -68,19 +80,19 @@ DEFAULT_DC_POLICY_GUID = "6AC1786C-016F-11D2-945F-00C04fB984F9" def find_setup_dir(): """Find the setup directory used by provision.""" - import sys - for prefix in [sys.prefix, - os.path.join(os.path.dirname(__file__), "../../../..")]: - 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 - dirname = os.path.dirname(__file__) - ret = os.path.join(dirname, "../../../setup") - if os.path.isdir(ret): - return ret - raise Exception("Unable to find setup directory.") + if in_source_tree(): + # In source tree + dirname = os.path.dirname(__file__) + return os.path.join(dirname, "../../../setup") + else: + import sys + for prefix in [sys.prefix, + os.path.join(os.path.dirname(__file__), "../../../..")]: + for suffix in ["share/setup", "share/samba/setup", "setup"]: + ret = os.path.join(prefix, suffix) + if os.path.isdir(ret): + return ret + raise Exception("Unable to find setup directory.") # Descriptors of naming contexts and other important objects |