bld = self.bld
+ default_env = bld.all_envs['default']
+ if self.env['IS_EXTRA_PYTHON']:
+ bld.all_envs['default'] = bld.all_envs['extrapython']
+
install_ldflags = install_rpath(self)
build_ldflags = build_rpath(bld)
# install link. That stops us from overwriting the existing build
# target, which has different ldflags
self.done_install_library = True
- t = self.clone('default')
+ t = self.clone(self.env)
t.posted = False
t.target += '.inst'
self.env.RPATH = build_ldflags
if dev_link:
bld.symlink_as(os.path.join(install_path, dev_link), os.path.basename(install_name))
+ bld.all_envs['default'] = default_env
+
@feature('cshlib')
@after('apply_implib')
@conf
def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
# enable tool to build python extensions
+ if conf.env['EXTRA_PYTHON']:
+ conf.all_envs['extrapython'] = conf.env.copy()
+ 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.check_tool('python')
+ try:
+ conf.check_python_version((3, 3, 0))
+ except Exception:
+ warn('extra-python needs to be Python 3.3 or later')
+ raise
+ conf.setenv('default')
+
conf.find_program('python', var='PYTHON', mandatory=mandatory)
conf.check_tool('python')
path_python = conf.find_program('python')
conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
conf.check_python_version(version)
+
@conf
def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
if conf.env["python_headers_checked"] == []:
- conf.check_python_headers(mandatory)
+ 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 Utils.WafError("extrapython %s is same as main python %s" % (
+ extraversion, conf.env['PYTHON_VERSION']))
else:
conf.msg("python headers", "using cache")
+
+def _check_python_headers(conf, mandatory):
+ conf.check_python_headers(mandatory=mandatory)
+
if conf.env['PYTHON_VERSION'] > '3':
abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % ''
help='tag release in git at the same time',
type='string', action='store', dest='TAG_RELEASE')
+ 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)
+
@wafsamba.runonce
def configure(conf):
conf.env.AUTOCONF_HOST = Options.options.AUTOCONF_HOST
conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX
+ conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON
+
if (conf.env.AUTOCONF_HOST and
conf.env.AUTOCONF_BUILD and
conf.env.AUTOCONF_BUILD != conf.env.AUTOCONF_HOST):