summaryrefslogtreecommitdiffstats
path: root/test/SWIG
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2007-07-14 15:30:04 (GMT)
committerSteven Knight <knight@baldmt.com>2007-07-14 15:30:04 (GMT)
commitc1c5babea02556d1dbf3280d7644aa3323f1b876 (patch)
tree0637b8519aaebc4e457f58553899ead8dedb1252 /test/SWIG
parent0bef9160a93a51ab9671c0a19d144ca027355e24 (diff)
downloadSCons-c1c5babea02556d1dbf3280d7644aa3323f1b876.zip
SCons-c1c5babea02556d1dbf3280d7644aa3323f1b876.tar.gz
SCons-c1c5babea02556d1dbf3280d7644aa3323f1b876.tar.bz2
Merged revisions 2121-2135 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r2128 | stevenknight | 2007-07-13 06:27:11 -0500 (Fri, 13 Jul 2007) | 2 lines Use the "swig -classic" option on pre-2.0 Python versions. ........ r2130 | stevenknight | 2007-07-13 09:42:45 -0500 (Fri, 13 Jul 2007) | 2 lines Remove left-over cut-and-paste stuff about loadable modules and frameworks. ........ r2131 | stevenknight | 2007-07-13 12:08:37 -0500 (Fri, 13 Jul 2007) | 4 lines Refactor the structure of the tests to make the java input strings separate from the parse_java() calls. (Prep for enhancing the parser for Java 1.5 anonymous class files.) ........ r2132 | stevenknight | 2007-07-13 12:24:09 -0500 (Fri, 13 Jul 2007) | 3 lines Copy the Java 1.4 nested-anonymous-class test case from test/Java/live.py. Remove a commented-out unit test already added elsewhere. ........ r2133 | stevenknight | 2007-07-13 16:16:51 -0500 (Fri, 13 Jul 2007) | 4 lines Support the changed naming of .class files for nested anonymous inner classes in Java 1.5 by adding a new $JAVAVERSION variable that can be set to reflect the javac version being used. ........ r2134 | stevenknight | 2007-07-13 20:28:34 -0500 (Fri, 13 Jul 2007) | 5 lines Add a $SWIGOUTDIR variable. Add it, when set, to the command line as an argument to -outdir. Have the emitter use it to figure out where the generated .java files will be (something we didn't do at all before, -outdir aside). ........ r2135 | stevenknight | 2007-07-13 23:51:21 -0500 (Fri, 13 Jul 2007) | 2 lines Minor unit test fixes for old Python versions (1.6 and 2.0). ........
Diffstat (limited to 'test/SWIG')
-rw-r--r--test/SWIG/SWIGOUTDIR.py66
-rw-r--r--test/SWIG/implicit-dependencies.py26
-rw-r--r--test/SWIG/live.py5
-rw-r--r--test/SWIG/remove-modules.py5
4 files changed, 77 insertions, 25 deletions
diff --git a/test/SWIG/SWIGOUTDIR.py b/test/SWIG/SWIGOUTDIR.py
new file mode 100644
index 0000000..69d535c
--- /dev/null
+++ b/test/SWIG/SWIGOUTDIR.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that use of the $SWIGOUTDIR variable causes SCons to recognize
+that Java files are created in the specified output directory.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write(['SConstruct'], """\
+env = Environment(tools = ['default', 'swig'])
+
+Java_foo_interface = env.SharedLibrary(
+ 'Java_foo_interface',
+ 'Java_foo_interface.i',
+ SWIGOUTDIR = 'java/build',
+ SWIGFLAGS = '-c++ -java -Wall',
+ SWIGCXXFILESUFFIX = "_wrap.cpp")
+""" % locals())
+
+test.write('Java_foo_interface.i', """\
+%module foopack
+""")
+
+# SCons should realize that it needs to create the java/build
+# subdirectory to hold the generate .java files.
+test.run(arguments = '.')
+
+# SCons should remove the built .java files.
+test.run(arguments = '-c java/build/foopack.java java/build/foopackJNI.java')
+
+test.must_not_exist('java/build/foopackJNI.java')
+test.must_not_exist('java/build/foopack.java')
+
+# SCons should realize it needs to rebuild the removed .java files.
+test.not_up_to_date(arguments = '.')
+
+
+
+test.pass_test()
diff --git a/test/SWIG/implicit-dependencies.py b/test/SWIG/implicit-dependencies.py
index 55645a4..81e3cf9 100644
--- a/test/SWIG/implicit-dependencies.py
+++ b/test/SWIG/implicit-dependencies.py
@@ -43,13 +43,6 @@ else:
python = TestSCons.python
_python_ = TestSCons._python_
-# swig-python expects specific filenames.
-# the platform specific suffix won't necessarily work.
-if sys.platform == 'win32':
- _dll = '.dll'
-else:
- _dll = '.so'
-
test = TestSCons.TestSCons()
swig = test.where_is('swig')
@@ -61,17 +54,6 @@ if not swig:
version = sys.version[:3] # see also sys.prefix documentation
-# handle testing on other platforms:
-ldmodule_prefix = '_'
-
-frameworks = ''
-platform_sys_prefix = sys.prefix
-if sys.platform == 'darwin':
- # OS X has a built-in Python but no static libpython
- # so you should link to it using apple's 'framework' scheme.
- # (see top of file for further explanation)
- frameworks = '-framework Python'
- platform_sys_prefix = '/System/Library/Frameworks/Python.framework/Versions/%s/' % version
test.write("dependency.i", """\
%module dependency
@@ -84,13 +66,7 @@ test.write("dependent.i", """\
""")
test.write('SConstruct', """
-foo = Environment(SWIGFLAGS='-python',
- CPPPATH='%(platform_sys_prefix)s/include/python%(version)s/',
- LDMODULEPREFIX='%(ldmodule_prefix)s',
- LDMODULESUFFIX='%(_dll)s',
- FRAMEWORKSFLAGS='%(frameworks)s',
- )
-
+foo = Environment(SWIGFLAGS='-python')
swig = foo.Dictionary('SWIG')
bar = foo.Clone(SWIG = r'%(_python_)s wrapper.py ' + swig)
foo.CFile(target = 'dependent', source = ['dependent.i'])
diff --git a/test/SWIG/live.py b/test/SWIG/live.py
index 93336ca..d319af7 100644
--- a/test/SWIG/live.py
+++ b/test/SWIG/live.py
@@ -99,6 +99,11 @@ foo = Environment(SWIGFLAGS='-python',
FRAMEWORKSFLAGS='%(frameworks)s',
)
+import sys
+if sys.version[0] == '1':
+ # SWIG requires the -classic flag on pre-2.0 Python versions.
+ foo.Append(SWIGFLAGS = ' -classic')
+
swig = foo.Dictionary('SWIG')
bar = foo.Clone(SWIG = r'%(_python_)s wrapper.py ' + swig)
foo.LoadableModule(target = 'foo', source = ['foo.c', 'foo.i'])
diff --git a/test/SWIG/remove-modules.py b/test/SWIG/remove-modules.py
index 1a48c9e..f5d4010 100644
--- a/test/SWIG/remove-modules.py
+++ b/test/SWIG/remove-modules.py
@@ -85,6 +85,11 @@ foo = Environment(SWIGFLAGS='-python',
FRAMEWORKSFLAGS='%(frameworks)s',
)
+import sys
+if sys.version[0] == '1':
+ # SWIG requires the -classic flag on pre-2.0 Python versions.
+ foo.Append(SWIGFLAGS = ' -classic')
+
foo.LoadableModule(target = 'modulename', source = ['module.i'])
""" % locals())