From f90b61a1eb5da911786db6b1606a6652457a4240 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 8 Jul 2018 12:04:06 -0700 Subject: Fix for py2.7 + 3.5+ --- test/SWIG/live.py | 1 + testing/framework/TestSCons.py | 13 ++++++++----- 2 files changed, 9 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/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 767570d..c9de47a 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -1264,12 +1264,12 @@ SConscript( sconscript ) 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') if sys.platform == 'win32': - self.run(program = python, stdin = """\ + self.run(program=python, stdin="""\ import sysconfig try: if sys.platform == 'win32': @@ -1293,11 +1293,14 @@ except: print(py_ver) """) else: - self.run(program = python, stdin = """\ -import sysconfig + self.run(program=python, stdin="""\ +import sys, sysconfig print(sysconfig.get_config_var("INCLUDEPY")) print(sysconfig.get_config_var("LIBDIR")) -print("python"+sysconfig.get_config_var("LDVERSION")) +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') -- cgit v0.12