summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2017-02-07 22:58:40 -0800
committerJeremy Allison <jra@samba.org>2017-02-09 20:04:12 +0100
commit468301bedda32057c12a2007f5500205ff8b0252 (patch)
treeb2e4dea4aabfdfbb85e4e07b3bbe111ac0454927 /buildtools
parent45df61e943696d84466e6379da1b28c6a4d50e87 (diff)
downloadsamba-468301bedda32057c12a2007f5500205ff8b0252.tar.gz
wafsamba: Move command line option function labelled as 'samba3' to the common set of functions
It allows to be used for things that are not 'samba3' only (or more accurately things not in common and not related to the AD DC implementation) Signed-off-by: Matthieu Patou <mat@matws.net> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba3.py31
-rw-r--r--buildtools/wafsamba/samba_utils.py27
2 files changed, 29 insertions, 29 deletions
diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index 6d06fd929a1..44daff9de2c 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -2,37 +2,10 @@
# and for SAMBA_ macros for building libraries, binaries etc
import Options, Build, os
-from optparse import SUPPRESS_HELP
-from samba_utils import os_path_relpath, TO_LIST
+from samba_utils import os_path_relpath, TO_LIST, samba_add_onoff_option
from samba_autoconf import library_flags
-
-def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True,
- with_name="with", without_name="without"):
- if default is None:
- default_str = "auto"
- elif default is True:
- default_str = "yes"
- elif default is False:
- default_str = "no"
- else:
- default_str = str(default)
-
- if help == ():
- help = ("Build with %s support (default=%s)" % (option, default_str))
- if dest is None:
- dest = "with_%s" % option.replace('-', '_')
-
- with_val = "--%s-%s" % (with_name, option)
- without_val = "--%s-%s" % (without_name, option)
-
- #FIXME: This is broken and will always default to "default" no matter if
- # --with or --without is chosen.
- opt.add_option(with_val, help=help, action="store_true", dest=dest,
- default=default)
- opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
- dest=dest)
-Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION
+Options.Handler.SAMBA3_ADD_OPTION = samba_add_onoff_option
def SAMBA3_IS_STATIC_MODULE(bld, module):
'''Check whether module is in static list'''
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 49a87597a9f..f5c0c53a75e 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -2,6 +2,7 @@
# and for SAMBA_ macros for building libraries, binaries etc
import os, sys, re, fnmatch, shlex
+from optparse import SUPPRESS_HELP
import Build, Options, Utils, Task, Logs, Configure
from TaskGen import feature, before, after
from Configure import conf, ConfigurationContext
@@ -669,3 +670,29 @@ def samba_before_apply_obj_vars(self):
if is_standard_libpath(v, i):
v['LIBPATH'].remove(i)
+def samba_add_onoff_option(opt, option, help=(), dest=None, default=True,
+ with_name="with", without_name="without"):
+ if default is None:
+ default_str = "auto"
+ elif default is True:
+ default_str = "yes"
+ elif default is False:
+ default_str = "no"
+ else:
+ default_str = str(default)
+
+ if help == ():
+ help = ("Build with %s support (default=%s)" % (option, default_str))
+ if dest is None:
+ dest = "with_%s" % option.replace('-', '_')
+
+ with_val = "--%s-%s" % (with_name, option)
+ without_val = "--%s-%s" % (without_name, option)
+
+ #FIXME: This is broken and will always default to "default" no matter if
+ # --with or --without is chosen.
+ opt.add_option(with_val, help=help, action="store_true", dest=dest,
+ default=default)
+ opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
+ dest=dest)
+Options.Handler.samba_add_onoff_option = samba_add_onoff_option