summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2018-07-08 19:15:08 (GMT)
committerGitHub <noreply@github.com>2018-07-08 19:15:08 (GMT)
commitd09bfdc164e27f59ce4dd46b216726e0bd8d5a24 (patch)
tree2296772710d8f4ac2f6b43e05fa968d7739fc789
parent4a5a41cfe8b2729b72bacea527605fb8a27a2212 (diff)
parentf90b61a1eb5da911786db6b1606a6652457a4240 (diff)
downloadSCons-d09bfdc164e27f59ce4dd46b216726e0bd8d5a24.zip
SCons-d09bfdc164e27f59ce4dd46b216726e0bd8d5a24.tar.gz
SCons-d09bfdc164e27f59ce4dd46b216726e0bd8d5a24.tar.bz2
Merge pull request #3144 from bdbaddog/fix_py3_swig_tests
Fix py3 swig tests
-rw-r--r--test/SWIG/live.py1
-rw-r--r--test/SWIG/recursive-includes-cpp.py5
-rw-r--r--testing/framework/TestSCons.py19
3 files changed, 20 insertions, 5 deletions
diff --git a/test/SWIG/live.py b/test/SWIG/live.py
index 684cff1..7c4bdce 100644
--- a/test/SWIG/live.py
+++ b/test/SWIG/live.py
@@ -46,6 +46,7 @@ swig = test.where_is('swig')
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
+
python, python_include, python_libpath, python_lib = \
test.get_platform_python_info()
Python_h = python_include + '/Python.h'
diff --git a/test/SWIG/recursive-includes-cpp.py b/test/SWIG/recursive-includes-cpp.py
index 2c74cc8..b943406 100644
--- a/test/SWIG/recursive-includes-cpp.py
+++ b/test/SWIG/recursive-includes-cpp.py
@@ -78,7 +78,7 @@ if TestCmd.IS_WINDOWS:
else:
TARGET_ARCH = ""
test.write('SConstruct', """\
-import distutils.sysconfig
+import sysconfig
import sys
import os
@@ -88,7 +88,7 @@ env = Environment(
'-python'
],
CPPPATH = [
- distutils.sysconfig.get_python_inc()
+ sysconfig.get_config_var("INCLUDEPY")
],
SHLIBPREFIX = "",
tools = [ 'default', 'swig' ]
@@ -96,6 +96,7 @@ env = Environment(
if sys.platform == 'darwin':
env['LIBS']=['python%d.%d'%(sys.version_info[0],sys.version_info[1])]
+ env.Append(LIBPATH=[sysconfig.get_config_var("LIBDIR")])
elif sys.platform == 'win32':
env.Append(LIBS=['python%d%d'%(sys.version_info[0],sys.version_info[1])])
env.Append(LIBPATH=[os.path.dirname(sys.executable) + "/libs"])
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py
index e625865..c9de47a 100644
--- a/testing/framework/TestSCons.py
+++ b/testing/framework/TestSCons.py
@@ -1261,13 +1261,16 @@ SConscript( sconscript )
Returns a path to a Python executable suitable for testing on
this platform and its associated include path, library path,
and library name.
+ Returns:
+ (path to python, include path, library path, library name)
"""
- python = os.environ.get('python_executable',self.where_is('python'))
+ python = os.environ.get('python_executable', self.where_is('python'))
if not python:
self.skip_test('Can not find installed "python", skipping test.\n')
- self.run(program = python, stdin = """\
-import os, sys
+ if sys.platform == 'win32':
+ self.run(program=python, stdin="""\
+import sysconfig
try:
if sys.platform == 'win32':
py_ver = 'python%d%d' % sys.version_info[:2]
@@ -1288,6 +1291,16 @@ except:
print(os.path.join(sys.prefix, 'include', py_ver))
print(os.path.join(sys.prefix, 'lib', py_ver, 'config'))
print(py_ver)
+ """)
+ else:
+ self.run(program=python, stdin="""\
+import sys, sysconfig
+print(sysconfig.get_config_var("INCLUDEPY"))
+print(sysconfig.get_config_var("LIBDIR"))
+py_library_ver = sysconfig.get_config_var("LDVERSION")
+if not py_library_ver:
+ py_library_ver = '%d.%d' % sys.version_info[:2]
+print("python"+py_library_ver)
""")
return [python] + self.stdout().strip().split('\n')