5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
32 _python_ = TestSCons._python_
34 _obj = TestSCons._shobj
35 obj_ = TestSCons.shobj_
37 test = TestSCons.TestSCons()
41 test.write('myg77.py', r"""
44 opts, args = getopt.getopt(sys.argv[1:], 'cf:o:x')
47 if opt == '-o': out = arg
48 elif opt != '-f': optstring = optstring + ' ' + opt
49 infile = open(args[0], 'rb')
50 outfile = open(out, 'wb')
51 outfile.write(optstring + "\n")
52 for l in infile.readlines():
60 test.write('SConstruct', """
61 env = Environment(SHF77 = r'%(_python_)s myg77.py')
62 env.Append(SHF77FLAGS = '-x')
63 env.SharedObject(target = 'test09', source = 'test09.f77')
64 env.SharedObject(target = 'test10', source = 'test10.F77')
67 test.write('test09.f77', "This is a .f77 file.\n#g77\n")
68 test.write('test10.F77', "This is a .F77 file.\n#g77\n")
70 test.run(arguments = '.', stderr = None)
72 test.must_match(obj_ + 'test09' + _obj, " -c -x\nThis is a .f77 file.\n")
73 test.must_match(obj_ + 'test10' + _obj, " -c -x\nThis is a .F77 file.\n")
77 g77 = test.detect_tool(fc)
81 test.write("wrapper.py",
85 open('%s', 'wb').write("wrapper.py\\n")
86 os.system(string.join(sys.argv[1:], " "))
87 """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
89 test.write('SConstruct', """
90 foo = Environment(SHF77 = '%(fc)s')
91 shf77 = foo.Dictionary('SHF77')
92 bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77,
93 tools = ["default", 'f77'], F77FILESUFFIXES = [".f"])
94 bar.Append(SHF77FLAGS = '-Ix')
95 foo.SharedLibrary(target = 'foo/foo', source = 'foo.f')
96 bar.SharedLibrary(target = 'bar/bar', source = 'bar.f')
99 test.write('foo.f', r"""
106 test.write('bar.f', r"""
114 test.run(arguments = 'foo', stderr = None)
116 test.must_not_exist('wrapper.out')
119 if sys.platform[:5] == 'sunos':
120 test.run(arguments = 'bar', stderr = None)
122 test.run(arguments = 'bar')
124 test.must_match('wrapper.out', "wrapper.py\n")