This option is quite invasive in waf and was mainly for the python3 transition.
Testing with multiple python versions can be done by testing a full compile against
multiple versions, likewise multiple different binding versions can be created
the same way.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
default_env = bld.all_envs['default']
try:
- if self.env['IS_EXTRA_PYTHON']:
- bld.all_envs['default'] = bld.all_envs['extrapython']
-
install_ldflags = install_rpath(self)
build_ldflags = build_rpath(bld)
interpreters = []
- if conf.env['EXTRA_PYTHON']:
- conf.all_envs['extrapython'] = conf.env.derive()
- conf.setenv('extrapython')
- conf.env['PYTHON'] = conf.env['EXTRA_PYTHON']
- conf.env['IS_EXTRA_PYTHON'] = 'yes'
- conf.find_program('python', var='PYTHON', mandatory=True)
- conf.load('python')
- try:
- conf.check_python_version(version)
- except Exception:
- Logs.warn('extra-python needs to be Python %s.%s.%s or later' %
- (version[0], version[1], version[2]))
- raise
- interpreters.append(conf.env['PYTHON'])
- conf.setenv('default')
-
conf.find_program('python3', var='PYTHON', mandatory=mandatory)
conf.load('python')
path_python = conf.find_program('python3')
return
if conf.env["python_headers_checked"] == []:
- if conf.env['EXTRA_PYTHON']:
- conf.setenv('extrapython')
- _check_python_headers(conf, mandatory=True)
- conf.setenv('default')
-
_check_python_headers(conf, mandatory)
conf.env["python_headers_checked"] = "yes"
- if conf.env['EXTRA_PYTHON']:
- extraversion = conf.all_envs['extrapython']['PYTHON_VERSION']
- if extraversion == conf.env['PYTHON_VERSION']:
- raise Errors.WafError("extrapython %s is same as main python %s" % (
- extraversion, conf.env['PYTHON_VERSION']))
else:
conf.msg("python headers", "using cache")
if not bld.PYTHON_BUILD_IS_ENABLED():
enabled = False
- if bld.env['IS_EXTRA_PYTHON']:
- name = 'extra-' + name
-
# when we support static python modules we'll need to gather
# the list from all the SAMBA_PYTHON() targets
if init_function_sentinel is not None:
Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
-def pyembed_libname(bld, name, extrapython=False):
+def pyembed_libname(bld, name):
if bld.env['PYTHON_SO_ABI_FLAG']:
return name + bld.env['PYTHON_SO_ABI_FLAG']
else:
with the extra-python environment active.
"""
yield
-
- if bld.env['EXTRA_PYTHON']:
- copied = ('GLOBAL_DEPENDENCIES', 'TARGET_TYPE') + tuple(extra_env_vars)
- for name in copied:
- bld.all_envs['extrapython'][name] = bld.all_envs['default'][name]
- default_env = bld.all_envs['default']
- bld.all_envs['default'] = bld.all_envs['extrapython']
- yield
- bld.all_envs['default'] = default_env
-
Build.BuildContext.gen_python_environments = gen_python_environments
enabled=True):
'''define a Samba library'''
- if pyembed and bld.env['IS_EXTRA_PYTHON']:
- public_headers = None
-
if private_library and public_headers:
raise Errors.WafError("private library '%s' must not have public header files" %
libname)
if pc_files is None:
raise Errors.WafError("public library '%s' must have pkg-config file" %
libname)
- if public_headers is None and not bld.env['IS_EXTRA_PYTHON']:
+ if public_headers is None:
raise Errors.WafError("public library '%s' must have header files" %
libname)
help='do not generate python modules',
action='store_true', dest='disable_python', default=False)
- opt.add_option('--extra-python', type=str,
- help=("build selected libraries for the specified "
- "additional version of Python "
- "(example: --extra-python=/usr/bin/python3)"),
- metavar="PYTHON", dest='EXTRA_PYTHON', default=None)
-
@Utils.run_once
def configure(conf):
conf.env.disable_python = Options.options.disable_python
- conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON
-
- if (conf.env.disable_python and conf.env.EXTRA_PYTHON):
- Logs.error('ERROR: cannot specify both --disable-python and --extra-python.')
- sys.exit(1)
-
if (conf.env.AUTOCONF_HOST and
conf.env.AUTOCONF_BUILD and
conf.env.AUTOCONF_BUILD != conf.env.AUTOCONF_HOST):
pyparam_util = bld.pyembed_libname('pyparam_util')
pyldb_util = bld.pyembed_libname('pyldb-util')
pyauth = 'pyauth'
- if bld.env['IS_EXTRA_PYTHON']:
- pyauth = 'extra-' + pyauth
bld.SAMBA_PYTHON('python_samba__ldb', 'pyldb.c',
deps='ldbsamba %s ldbwrap %s %s' % (pyparam_util, pyldb_util, pyauth),
realname='samba/_ldb.so')
implied_deps='replace talloc tdb tevent ldb'):
using_system_pyldb_util = False
- # We need to get a pyldb-util for all the python versions
- # we are building for
- if conf.env['EXTRA_PYTHON']:
- name = 'pyldb-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG']
- if not conf.CHECK_BUNDLED_SYSTEM_PKG(name,
- minversion=VERSION,
- maxversion=max_ldb_version_dots,
- onlyif='talloc tdb tevent',
- implied_deps='replace talloc tdb tevent ldb'):
- using_system_pyldb_util = False
-
if using_system_pyldb_util:
conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
implied_deps='talloc replace'):
using_system_pytalloc_util = False
- # We need to get a pytalloc-util for all the python versions
- # we are building for
- if conf.env['EXTRA_PYTHON']:
- name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG']
- if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
- implied_deps='talloc replace'):
- using_system_pytalloc_util = False
if using_system_pytalloc_util:
conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
for env in bld.gen_python_environments():
pycredentials = 'pycredentials'
- if bld.env['IS_EXTRA_PYTHON']:
- pycredentials = 'extra-' + pycredentials
bld.SAMBA3_PYTHON('pylibsmb',
source='libsmb/pylibsmb.c',
deps='smbclient samba-credentials %s' % pycredentials,
pyparam_util = bld.pyembed_libname('pyparam_util')
pyldb_util = bld.pyembed_libname('pyldb-util')
pycredentials = 'pycredentials'
- if bld.env['IS_EXTRA_PYTHON']:
- pycredentials = 'extra-' + pycredentials
bld.SAMBA_PYTHON('pyauth',
source='pyauth.c',
public_deps='auth_system_session',
provision = bld.pyembed_libname('PROVISION')
name = bld.pyembed_libname('samba-net')
auto_proto='libnet_proto.h'
- if bld.env['IS_EXTRA_PYTHON']:
- auto_proto=None
bld.SAMBA_LIBRARY(name,
source='libnet.c libnet_passwd.c libnet_time.c libnet_rpc.c libnet_join.c libnet_site.c libnet_become_dc.c libnet_unbecome_dc.c libnet_vampire.c libnet_samdump.c libnet_samsync_ldb.c libnet_user.c libnet_group.c libnet_share.c libnet_lookup.c libnet_domain.c userinfo.c groupinfo.c userman.c groupman.c prereq_domain.c libnet_samsync.c',
autoproto=auto_proto,
)
python_netlogon = 'python_netlogon'
- if bld.env['IS_EXTRA_PYTHON']:
- python_netlogon = 'extra-' + python_netlogon
bld.SAMBA_PYTHON('python_winbind',
source='../../librpc/gen_ndr/py_winbind.c',
deps='RPC_NDR_WINBIND %s %s %s' % (pytalloc_util, pyrpc_util, python_netlogon),