summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-02-15 16:13:48 +1300
committerAndrew Bartlett <abartlet@samba.org>2019-03-21 04:06:16 +0000
commita574e8f51706809fff4b77ff098b28ba1a7d4103 (patch)
treee97251182fa1d94bf22ab13823691c2dcff68c44
parenta459650054b5500026b6387fb0eb2ef29ced9b5f (diff)
downloadsamba-a574e8f51706809fff4b77ff098b28ba1a7d4103.tar.gz
build: Standardise on calling conf.SAMBA_CHECK_PYTHON() in libraries
We do this by removing the confusing mandatory option to conf.SAMBA_CHECK_PYTHON{,_HEADERS}(), instead just use the value of --disable-python internally This follows the default minimum of Python 3.4 and keeps things consistent with the main Samba build where --disable-python is required to skip building python bindings. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
-rw-r--r--buildtools/wafsamba/samba_python.py23
-rw-r--r--ctdb/wscript6
-rw-r--r--lib/ldb/wscript6
-rw-r--r--lib/talloc/wscript12
-rw-r--r--lib/tdb/wscript10
-rw-r--r--lib/tevent/wscript11
-rw-r--r--wscript4
7 files changed, 22 insertions, 50 deletions
diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index 598f83d68e8..4476d335248 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -5,9 +5,9 @@ from waflib import Build, Logs, Utils, Configure, Errors
from waflib.Configure import conf
@conf
-def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(3,4,0)):
+def SAMBA_CHECK_PYTHON(conf, version=(3,4,0)):
- if not mandatory:
+ if conf.env.disable_python:
version=(2,6,0)
# enable tool to build python extensions
@@ -17,7 +17,8 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(3,4,0)):
interpreters = []
- conf.find_program('python3', var='PYTHON', mandatory=mandatory)
+ conf.find_program('python3', var='PYTHON',
+ mandatory=not conf.env.disable_python)
conf.load('python')
path_python = conf.find_program('python3')
@@ -29,11 +30,8 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(3,4,0)):
@conf
-def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
+def SAMBA_CHECK_PYTHON_HEADERS(conf):
if conf.env.disable_python:
- if mandatory:
- raise Errors.WafError("Cannot check for python headers when "
- "--disable-python specified")
conf.msg("python headers", "Check disabled due to --disable-python")
# we don't want PYTHONDIR in config.h, as otherwise changing
@@ -45,7 +43,7 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
return
if conf.env["python_headers_checked"] == []:
- _check_python_headers(conf, mandatory)
+ _check_python_headers(conf)
conf.env["python_headers_checked"] = "yes"
else:
@@ -57,13 +55,8 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
if not x.startswith('PYTHONDIR=')
and not x.startswith('PYTHONARCHDIR=')]
-def _check_python_headers(conf, mandatory):
- try:
- conf.errors.ConfigurationError
- conf.check_python_headers()
- except conf.errors.ConfigurationError:
- if mandatory:
- raise
+def _check_python_headers(conf):
+ conf.check_python_headers()
if conf.env['PYTHON_VERSION'] > '3':
abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
diff --git a/ctdb/wscript b/ctdb/wscript
index 15dd75708f0..3fa525b564d 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -140,8 +140,10 @@ def configure(conf):
if conf.env.standalone_ctdb:
conf.SAMBA_CHECK_PERL(mandatory=True)
- conf.SAMBA_CHECK_PYTHON(mandatory=False)
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
+ # This is just for consistency and to check the version for the
+ # build system, see Options.options.disable_python = True above
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
if conf.CHECK_FOR_THIRD_PARTY():
conf.RECURSE('third_party/popt')
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 4f0c68c9c6c..7a8b307fb22 100644
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -58,11 +58,9 @@ def configure(conf):
conf.define('USING_SYSTEM_CMOCKA', 1)
conf.RECURSE('lib/replace')
- conf.find_program('python', var='PYTHON')
conf.find_program('xsltproc', var='XSLTPROC')
- conf.load('python')
- conf.check_python_version((2,4,2))
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=not conf.env.disable_python)
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
# where does the default LIBDIR end up? in conf.env somewhere?
#
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index 827ae88498b..6947b1d0b80 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -57,16 +57,8 @@ def configure(conf):
conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
- # We need to set everything non-python up before here, because
- # SAMBA_CHECK_PYTHON makes a copy of conf and we need it set up correctly
-
- if not conf.env.disable_python:
- # also disable if we don't have the python libs installed
- conf.SAMBA_CHECK_PYTHON(mandatory=False)
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
- if not conf.env.HAVE_PYTHON_H:
- Logs.warn('Disabling pytalloc-util as python devel libs not found')
- conf.env.disable_python = True
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
if not conf.env.standalone_talloc:
if conf.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion=VERSION,
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index c616b40fbe5..02105d06c84 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -97,14 +97,8 @@ def configure(conf):
conf.CHECK_XSLTPROC_MANPAGES()
- if not conf.env.disable_python:
- # also disable if we don't have the python libs installed
- conf.SAMBA_CHECK_PYTHON(mandatory=False)
- conf.check_python_version((2,4,2))
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
- if not conf.env.HAVE_PYTHON_H:
- Logs.warn('Disabling pytdb as python devel libs not found')
- conf.env.disable_python = True
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
conf.SAMBA_CONFIG_H()
diff --git a/lib/tevent/wscript b/lib/tevent/wscript
index a9288add0a3..df3068af487 100644
--- a/lib/tevent/wscript
+++ b/lib/tevent/wscript
@@ -60,15 +60,8 @@ def configure(conf):
if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
- if not conf.env.disable_python:
- # also disable if we don't have the python libs installed
- conf.find_program('python', var='PYTHON')
- conf.load('python')
- conf.check_python_version((2,4,2))
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
- if not conf.env.HAVE_PYTHON_H:
- Logs.warn('Disabling pytevent as python devel libs not found')
- conf.env.disable_python = True
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
conf.SAMBA_CONFIG_H()
diff --git a/wscript b/wscript
index a0a8080b448..47fc2ba2460 100644
--- a/wscript
+++ b/wscript
@@ -151,8 +151,8 @@ def configure(conf):
if not (Options.options.without_ad_dc):
raise Errors.WafError('--disable-python requires --without-ad-dc')
- conf.SAMBA_CHECK_PYTHON(mandatory=not conf.env.disable_python)
- conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=(not conf.env.disable_python))
+ conf.SAMBA_CHECK_PYTHON()
+ conf.SAMBA_CHECK_PYTHON_HEADERS()
if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
# Mac OSX needs to have this and it's also needed that the python is compiled with this