diff options
author | Mats Wichmann <mats@linux.com> | 2018-10-16 15:39:13 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2018-10-16 15:39:44 (GMT) |
commit | 4ff8514b2cfffeda032b657e1d59c5ec7988fe88 (patch) | |
tree | 70d673a0d9dc6f8a93d2dc59e2a277c17fa0ea7b /testing | |
parent | e422f8fa002b9cbe6fb5785c301cfc63d8843a99 (diff) | |
download | SCons-4ff8514b2cfffeda032b657e1d59c5ec7988fe88.zip SCons-4ff8514b2cfffeda032b657e1d59c5ec7988fe88.tar.gz SCons-4ff8514b2cfffeda032b657e1d59c5ec7988fe88.tar.bz2 |
Additional fixes for SWIG tests
Two tests were missing the raw-string marker when defining
the Python include path.
TestSCons:get_platform_python_info needed some rework for Windows,
it was failing to find the python library if running in a virtual
environment. Also removed a try-block; sys.version_info is standard
since Python 2.0 and so does not need wrapping.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestSCons.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index feadef9..68641f0 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -861,7 +861,7 @@ class TestSCons(TestCommon): # Java 11 outputs this to stdout if not m: m = re.search(r'javac (\d\.*\d)', self.stdout()) - + if m: version = m.group(1) self.javac_is_gcj = False @@ -1286,11 +1286,9 @@ SConscript( sconscript ) if sys.platform == 'win32': self.run(program=python, stdin="""\ import sysconfig, sys, os.path -try: - py_ver = 'python%d%d' % sys.version_info[:2] -except AttributeError: - py_ver = 'python' + sys.version[:3] -# print include and lib path +py_ver = 'python%d%d' % sys.version_info[:2] +# use distutils to help find include and lib path +# TODO: PY3 fine to use sysconfig.get_config_var("INCLUDEPY") try: import distutils.sysconfig exec_prefix = distutils.sysconfig.EXEC_PREFIX @@ -1298,12 +1296,23 @@ try: print(include) lib_path = os.path.join(exec_prefix, 'libs') if not os.path.exists(lib_path): + # check for virtualenv path. + # this might not build anything different than first try. + def venv_path(): + if hasattr(sys, 'real_prefix'): + return sys.real_prefix + if hasattr(sys, 'base_prefix'): + return sys.base_prefix + lib_path = os.path.join(venv_path(), 'libs') + if not os.path.exists(lib_path): + # not clear this is useful: 'lib' does not contain linkable libs lib_path = os.path.join(exec_prefix, 'lib') print(lib_path) except: include = os.path.join(sys.prefix, 'include', py_ver) print(include) - print(os.path.join(sys.prefix, 'lib', py_ver, 'config')) + lib_path = os.path.join(sys.prefix, 'lib', py_ver, 'config') + print(lib_path) print(py_ver) Python_h = os.path.join(include, "Python.h") if os.path.exists(Python_h): |