summaryrefslogtreecommitdiffstats
path: root/test/SWIG/live.py
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2009-04-18 16:56:22 (GMT)
committerGreg Noel <GregNoel@tigris.org>2009-04-18 16:56:22 (GMT)
commit588cf4a4fae059bb156ee086ff01a92b2ee025a9 (patch)
treedf97f69bcf6db6082047925e185d179fa442af55 /test/SWIG/live.py
parent935a23efa2fe53e9dcbf7df8e99f8ee424834f96 (diff)
downloadSCons-588cf4a4fae059bb156ee086ff01a92b2ee025a9.zip
SCons-588cf4a4fae059bb156ee086ff01a92b2ee025a9.tar.gz
SCons-588cf4a4fae059bb156ee086ff01a92b2ee025a9.tar.bz2
Modify the SWIG tests so that OS X is treated like a UNIX platform (which it
really is). OS X now not only runs all the SWIG tests (it used to skip many of them because it could not find the appropriate files), it now passes all the tests.
Diffstat (limited to 'test/SWIG/live.py')
-rw-r--r--test/SWIG/live.py34
1 files changed, 9 insertions, 25 deletions
diff --git a/test/SWIG/live.py b/test/SWIG/live.py
index 0caa9b5..0a4c905 100644
--- a/test/SWIG/live.py
+++ b/test/SWIG/live.py
@@ -47,31 +47,15 @@ swig = test.where_is('swig')
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-
-python = test.where_is('python')
-
-# handle testing on other platforms:
-ldmodule_prefix = '_'
-
-test.run(program = python, stdin = """\
-import os, sys
-try:
- py_ver = 'python%d.%d' % sys.version_info[:2]
-except AttributeError:
- py_ver = 'python' + sys.version[:3]
-print os.path.join(sys.prefix, 'include', py_ver)
-print os.path.join(sys.prefix, 'lib', py_ver, 'config')
-print py_ver
-""")
-
-#TODO(1.5) config_info = test.stdout().strip().split('\n')
-config_info = string.split(string.strip(test.stdout()), '\n')
-python_include,python_libpath,python_lib = config_info
-
+python, python_include, python_libpath, python_lib = \
+ test.get_platform_python_info()
Python_h = os.path.join(python_include, 'Python.h')
if not os.path.exists(Python_h):
test.skip_test('Can not find %s, skipping test.\n' % Python_h)
+# handle testing on other platforms:
+ldmodule_prefix = '_'
+
test.write("wrapper.py",
"""import os
import string
@@ -82,11 +66,11 @@ os.system(string.join(sys.argv[1:], " "))
test.write('SConstruct', """\
foo = Environment(SWIGFLAGS='-python',
- CPPPATH=r'%(python_include)s',
+ CPPPATH=[r'%(python_include)s'],
LDMODULEPREFIX='%(ldmodule_prefix)s',
LDMODULESUFFIX='%(_dll)s',
- SWIG=r'%(swig)s',
- LIBPATH=r'%(python_libpath)s',
+ SWIG=[r'%(swig)s'],
+ LIBPATH=[r'%(python_libpath)s'],
LIBS='%(python_lib)s',
)
@@ -96,7 +80,7 @@ if sys.version[0] == '1':
foo.Append(SWIGFLAGS = ' -classic')
swig = foo.Dictionary('SWIG')
-bar = foo.Clone(SWIG = r'"%(python)s" wrapper.py ' + swig)
+bar = foo.Clone(SWIG = [r'%(python)s', 'wrapper.py', swig])
foo.LoadableModule(target = 'foo', source = ['foo.c', 'foo.i'])
bar.LoadableModule(target = 'bar', source = ['bar.c', 'bar.i'])
""" % locals())