diff options
author | William Deegan <bill@baddogconsulting.com> | 2018-07-08 19:15:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 19:15:08 (GMT) |
commit | d09bfdc164e27f59ce4dd46b216726e0bd8d5a24 (patch) | |
tree | 2296772710d8f4ac2f6b43e05fa968d7739fc789 | |
parent | 4a5a41cfe8b2729b72bacea527605fb8a27a2212 (diff) | |
parent | f90b61a1eb5da911786db6b1606a6652457a4240 (diff) | |
download | SCons-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.py | 1 | ||||
-rw-r--r-- | test/SWIG/recursive-includes-cpp.py | 5 | ||||
-rw-r--r-- | testing/framework/TestSCons.py | 19 |
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') |