summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/SWIG/SWIG.py8
-rw-r--r--test/SWIG/SWIGOUTDIR-python.py18
-rw-r--r--test/SWIG/SWIGPATH.py8
-rw-r--r--test/SWIG/build-dir.py18
-rw-r--r--test/SWIG/implicit-dependencies.py8
-rw-r--r--test/SWIG/live.py34
-rw-r--r--test/SWIG/module-parens.py18
-rw-r--r--test/SWIG/module-quoted.py16
-rw-r--r--test/SWIG/noproxy.py20
-rw-r--r--test/SWIG/remove-modules.py25
-rw-r--r--test/SWIG/subdir.py22
11 files changed, 81 insertions, 114 deletions
diff --git a/test/SWIG/SWIG.py b/test/SWIG/SWIG.py
index d76ef64..3ddc686 100644
--- a/test/SWIG/SWIG.py
+++ b/test/SWIG/SWIG.py
@@ -35,8 +35,9 @@ _obj = TestSCons._obj
test = TestSCons.TestSCons()
-_python_ = test.get_quoted_platform_python()
-
+python = test.where_is('python')
+if not python:
+ test,skip_test('Can not find installed "python", skipping test.\n')
test.write('myswig.py', r"""
@@ -55,7 +56,8 @@ sys.exit(0)
""")
test.write('SConstruct', """
-env = Environment(tools=['default', 'swig'], SWIG = r'%(_python_)s myswig.py')
+env = Environment(tools=['default', 'swig'],
+ SWIG = [r'%(python)s', 'myswig.py'])
env.Program(target = 'test1', source = 'test1.i')
env.CFile(target = 'test2', source = 'test2.i')
env.Clone(SWIGFLAGS = '-c++').Program(target = 'test3', source = 'test3.i')
diff --git a/test/SWIG/SWIGOUTDIR-python.py b/test/SWIG/SWIGOUTDIR-python.py
index 3f6667e..763e9c4 100644
--- a/test/SWIG/SWIGOUTDIR-python.py
+++ b/test/SWIG/SWIGOUTDIR-python.py
@@ -34,27 +34,23 @@ import os
test = TestSCons.TestSCons()
-test = TestSCons.TestSCons()
-
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-python_include_dir = test.get_python_inc()
-
-python_frameworks_flags = test.get_python_frameworks_flags()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
+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)
test.write(['SConstruct'], """\
env = Environment(SWIGFLAGS = '-python -c++',
- CPPPATH=r"%(python_include_dir)s",
- SWIG=r'%(swig)s',
+ CPPPATH=[r"%(python_include)s"],
+ SWIG=[r'%(swig)s'],
SWIGOUTDIR='python/build dir',
- FRAMEWORKS='%(python_frameworks_flags)s',
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
)
import sys
diff --git a/test/SWIG/SWIGPATH.py b/test/SWIG/SWIGPATH.py
index 4832814..30426da 100644
--- a/test/SWIG/SWIGPATH.py
+++ b/test/SWIG/SWIGPATH.py
@@ -33,12 +33,12 @@ import TestSCons
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-_python_ = test.get_quoted_platform_python()
-
+python = test.where_is('python')
+if not python:
+ test,skip_test('Can not find installed "python", skipping test.\n')
test.subdir('inc1', 'inc2')
@@ -57,7 +57,7 @@ test.write('SConstruct', """
foo = Environment(SWIGFLAGS='-python',
SWIGPATH=['inc1', 'inc2'])
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.CFile(target = 'dependent', source = ['dependent.i'])
""" % locals())
diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py
index 5fa3ceb..d5b5236 100644
--- a/test/SWIG/build-dir.py
+++ b/test/SWIG/build-dir.py
@@ -38,7 +38,6 @@ import TestSCons
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
@@ -51,27 +50,26 @@ else:
test.subdir(['source'])
-python_include_dir = test.get_python_inc()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
-
+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)
-python_frameworks_flags = test.get_python_frameworks_flags()
-
test.write(['SConstruct'], """\
#
# Create the build environment.
#
-env = Environment(CPPPATH = [".", r'%(python_include_dir)s'],
+env = Environment(CPPPATH = [".", r'%(python_include)s'],
CPPDEFINES = "NDEBUG",
- SWIG =r'%(swig)s',
+ SWIG = [r'%(swig)s'],
SWIGFLAGS = ["-python", "-c++"],
SWIGCXXFILESUFFIX = "_wrap.cpp",
LDMODULEPREFIX='_',
LDMODULESUFFIX='%(_dll)s',
- FRAMEWORKS='%(python_frameworks_flags)s')
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
+ )
import sys
if sys.version[0] == '1':
diff --git a/test/SWIG/implicit-dependencies.py b/test/SWIG/implicit-dependencies.py
index 49f9cc7..6d40216 100644
--- a/test/SWIG/implicit-dependencies.py
+++ b/test/SWIG/implicit-dependencies.py
@@ -33,12 +33,12 @@ import TestSCons
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-_python_ = test.get_quoted_platform_python()
-
+python = test.where_is('python')
+if not python:
+ test.skip_test('Can not find installed "python", skipping test.\n')
test.write("dependency.i", """\
@@ -54,7 +54,7 @@ test.write("dependent.i", """\
test.write('SConstruct', """
foo = Environment(SWIGFLAGS='-python')
swig = foo.Dictionary('SWIG')
-bar = foo.Clone(SWIG = r'%(_python_)s wrapper.py ' + swig)
+bar = foo.Clone(SWIG = [r'%(python)s', r'wrapper.py', swig])
foo.CFile(target = 'dependent', source = ['dependent.i'])
""" % locals())
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())
diff --git a/test/SWIG/module-parens.py b/test/SWIG/module-parens.py
index f80e10c..7886218 100644
--- a/test/SWIG/module-parens.py
+++ b/test/SWIG/module-parens.py
@@ -35,24 +35,22 @@ import TestSCons
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-python_include_dir = test.get_python_inc()
-
-python_frameworks_flags = test.get_python_frameworks_flags()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
+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)
test.write(['SConstruct'], """\
env = Environment(SWIGFLAGS = '-python -c++',
- CPPPATH=r"%(python_include_dir)s",
- SWIG=r'%(swig)s',
- FRAMEWORKS='%(python_frameworks_flags)s',
- )
+ CPPPATH=[r'%(python_include)s'],
+ SWIG=[r'%(swig)s'],
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
+ )
import sys
if sys.version[0] == '1':
diff --git a/test/SWIG/module-quoted.py b/test/SWIG/module-quoted.py
index 2001582..89402eb 100644
--- a/test/SWIG/module-quoted.py
+++ b/test/SWIG/module-quoted.py
@@ -35,23 +35,21 @@ import TestSCons
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-python_include_dir = test.get_python_inc()
-
-python_frameworks_flags = test.get_python_frameworks_flags()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
+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)
test.write(['SConstruct'], """\
env = Environment(SWIGFLAGS = '-python -c++',
- CPPPATH=r"%(python_include_dir)s",
- SWIG=r'%(swig)s',
- FRAMEWORKS='%(python_frameworks_flags)s',
+ CPPPATH=[r'%(python_include)s'],
+ SWIG=[r'%(swig)s'],
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
)
import sys
diff --git a/test/SWIG/noproxy.py b/test/SWIG/noproxy.py
index 0d109b8..1aaeb08 100644
--- a/test/SWIG/noproxy.py
+++ b/test/SWIG/noproxy.py
@@ -29,6 +29,7 @@ Verify that SCons realizes the -noproxy option means no .py file will
be created.
"""
+import os
import sys
import TestSCons
@@ -43,19 +44,18 @@ else:
test = TestSCons.TestSCons()
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-_python_ = test.get_quoted_platform_python()
+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 = '_'
-python_include_dir = test.get_python_inc()
-
-python_frameworks_flags = test.get_python_frameworks_flags()
-
test.write("dependency.i", """\
%module dependency
""")
@@ -68,14 +68,16 @@ test.write("dependent.i", """\
test.write('SConstruct', """
foo = Environment(SWIGFLAGS=['-python', '-noproxy'],
- CPPPATH='%(python_include_dir)s',
+ CPPPATH=[r'%(python_include)s'],
LDMODULEPREFIX='%(ldmodule_prefix)s',
LDMODULESUFFIX='%(_dll)s',
- FRAMEWORKS='%(python_frameworks_flags)s',
+ SWIG=[r'%(swig)s'],
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
)
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.CFile(target = 'dependent', source = ['dependent.i'])
""" % locals())
diff --git a/test/SWIG/remove-modules.py b/test/SWIG/remove-modules.py
index e0e91da..8ed24ef 100644
--- a/test/SWIG/remove-modules.py
+++ b/test/SWIG/remove-modules.py
@@ -39,29 +39,23 @@ import TestSCons
if sys.platform == 'win32':
_dll = '.dll'
else:
- _dll = '.so'
+ _dll = '.so'
test = TestSCons.TestSCons()
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 = 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 = '_'
-python_include_dir = test.get_python_inc()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
-
-if not os.path.exists(Python_h):
- test.skip_test('Can not find %s, skipping test.\n' % Python_h)
-
-python_frameworks_flags = test.get_python_frameworks_flags()
-
test.write("module.i", """\
%module modulename
@@ -69,11 +63,12 @@ test.write("module.i", """\
test.write('SConstruct', """
foo = Environment(SWIGFLAGS='-python',
- CPPPATH='%(python_include_dir)s',
+ CPPPATH=['%(python_include)s'],
LDMODULEPREFIX='%(ldmodule_prefix)s',
LDMODULESUFFIX='%(_dll)s',
- FRAMEWORKS='%(python_frameworks_flags)s',
- SWIG=r'%(swig)s',
+ SWIG=[r'%(swig)s'],
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
)
import sys
diff --git a/test/SWIG/subdir.py b/test/SWIG/subdir.py
index 6a746f3..d4798f6 100644
--- a/test/SWIG/subdir.py
+++ b/test/SWIG/subdir.py
@@ -46,32 +46,26 @@ test = TestSCons.TestSCons()
test.subdir('sub')
swig = test.where_is('swig')
-
if not swig:
test.skip_test('Can not find installed "swig", skipping test.\n')
-python = test.get_platform_python()
-_python_ = test.get_quoted_platform_python()
-
-# handle testing on other platforms:
-ldmodule_prefix = '_'
-
-python_include_dir = test.get_python_inc()
-
-Python_h = os.path.join(python_include_dir, 'Python.h')
-
+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)
-python_frameworks_flags = test.get_python_frameworks_flags()
+# handle testing on other platforms:
+ldmodule_prefix = '_'
test.write('SConstruct', """
env = Environment(SWIGFLAGS='-python',
- CPPPATH='%(python_include_dir)s/',
+ CPPPATH=['%(python_include)s/'],
LDMODULEPREFIX='%(ldmodule_prefix)s',
LDMODULESUFFIX='%(_dll)s',
- FRAMEWORKS='%(python_frameworks_flags)s',
SWIG=r'%(swig)s',
+ LIBPATH=[r'%(python_libpath)s'],
+ LIBS='%(python_lib)s',
)
import sys