1--- buildtools/wafsamba/samba_python.py.orig 2018-01-13 09:07:51 UTC 2+++ buildtools/wafsamba/samba_python.py 3@@ -76,17 +76,35 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, man 4 5 def _check_python_headers(conf, mandatory): 6 try: 7+ from python import _get_python_variables 8 Configure.ConfigurationError 9 conf.check_python_headers(mandatory=mandatory) 10+ conf.env['PYTHON_SO_ABI'] = _get_python_variables( 11+ conf.env['PYTHON'], 12+ ["get_config_var('SOABI') or ''"], 13+ ['from distutils.sysconfig import get_config_var'] 14+ )[0] 15 except Configure.ConfigurationError: 16 if mandatory: 17 raise 18 19 if conf.env['PYTHON_VERSION'] > '3': 20- abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0] 21- conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % '' 22+ '''Be caucious here - conf parameter is PYTHON_SO_ABI_FLAG, 23+ while environment variable is PYTHON3_SO_ABI_FLAG''' 24+ override_PYTHON_SO_ABI_FLAG = os.getenv('PYTHON3_SO_ABI_FLAG', None) 25+ if override_PYTHON_SO_ABI_FLAG is not None: 26+ conf.env['PYTHON_SO_ABI_FLAG'] = override_PYTHON_SO_ABI_FLAG 27+ conf.env['pyext_PATTERN'] = '%%s%s.%s' % (conf.env['PYTHON_SO_ABI_FLAG'], conf.env['SHLIBEXT']) 28+ if not conf.env['PYTHON_SO_ABI_FLAG']: 29+ if conf.env['PYTHON_SO_ABI']: 30+ conf.env['PYTHON_SO_ABI_FLAG'] = '.'+conf.env['PYTHON_SO_ABI'] 31+ conf.env['pyext_PATTERN'] = '%%s%s.%s' % (conf.env['PYTHON_SO_ABI_FLAG'], conf.env['SHLIBEXT']) 32+ else: 33+ abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0] 34+ conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % '' 35 else: 36 conf.env['PYTHON_SO_ABI_FLAG'] = '' 37+ 38 conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = ( 39 conf.env['PYTHON_SO_ABI_FLAG'].replace('_', '-')) 40 41