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
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')
@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
return
if conf.env["python_headers_checked"] == []:
- _check_python_headers(conf, mandatory)
+ _check_python_headers(conf)
conf.env["python_headers_checked"] = "yes"
else:
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]
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')
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?
#
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,
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()
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()
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