1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

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>
This commit is contained in:
Andrew Bartlett 2019-02-15 16:13:48 +13:00
parent a459650054
commit a574e8f517
7 changed files with 22 additions and 50 deletions

View File

@ -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]

View File

@ -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')

View File

@ -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?
#

View File

@ -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,

View File

@ -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()

View File

@ -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()

View File

@ -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