__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import string
import SCons.Defaults
import SCons.Errors
if l[:5] != '#link':
outfile.write(l)
sys.exit(0)
-""")
-
- test.write('myg77.py', r"""
-import sys
-args = sys.argv[1:]
-inf = None
-while args:
- a = args[0]
- args = args[1:]
- if a[0] != '/':
- if not inf:
- inf = a
- continue
- if a[:3] == '/Fo': out = a[3:]
-infile = open(inf, 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
""")
else:
sys.exit(0)
""")
- test.write('myg77.py', r"""
+test.write('myg77.py', r"""
import getopt
import sys
opts, args = getopt.getopt(sys.argv[1:], 'co:')
_exe = '.exe'
- o = ' -x /c'
-
test.write('mylink.py', r"""
import string
import sys
if l[:5] != '#link':
outfile.write(l)
sys.exit(0)
-""")
-
- test.write('myg77.py', r"""
-import sys
-args = sys.argv[1:]
-inf = None
-optstring = ''
-while args:
- a = args[0]
- args = args[1:]
- if not a[0] in '/-':
- if not inf:
- inf = a
- continue
- if a[:3] == '/Fo':
- out = a[3:]
- continue
- optstring = optstring + ' ' + a
-infile = open(inf, 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
""")
else:
_exe = ''
- o = ' -x -c'
-
test.write('mylink.py', r"""
import getopt
import sys
sys.exit(0)
""")
- test.write('myg77.py', r"""
+test.write('myg77.py', r"""
import getopt
import sys
opts, args = getopt.getopt(sys.argv[1:], 'co:x')
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read('test1' + _exe) != "%s\nThis is a .f file.\n" % o)
+test.fail_test(test.read('test1' + _exe) != " -x -c\nThis is a .f file.\n")
-test.fail_test(test.read('test2' + _exe) != "%s\nThis is a .for file.\n" % o)
+test.fail_test(test.read('test2' + _exe) != " -x -c\nThis is a .for file.\n")
-test.fail_test(test.read('test3' + _exe) != "%s\nThis is a .FOR file.\n" % o)
+test.fail_test(test.read('test3' + _exe) != " -x -c\nThis is a .FOR file.\n")
-test.fail_test(test.read('test4' + _exe) != "%s\nThis is a .F file.\n" % o)
+test.fail_test(test.read('test4' + _exe) != " -x -c\nThis is a .F file.\n")
-test.fail_test(test.read('test5' + _exe) != "%s\nThis is a .fpp file.\n" % o)
+test.fail_test(test.read('test5' + _exe) != " -x -c\nThis is a .fpp file.\n")
-test.fail_test(test.read('test6' + _exe) != "%s\nThis is a .FPP file.\n" % o)
+test.fail_test(test.read('test6' + _exe) != " -x -c\nThis is a .FPP file.\n")
test = TestSCons.TestSCons()
+if not test.where_is('g77'):
+ print "g77 is not installed on this system."
+ print "Cannot test F77PATH."
+ test.no_result(1)
+
test.subdir('include', 'subdir', ['subdir', 'include'], 'inc2')
test.write('SConstruct', """
test.fail_test(oldtime1 == os.path.getmtime(foo1))
test.fail_test(oldtime2 != os.path.getmtime(foo2))
-# Verify that scons prints an error message if a target can not be unlinked before
-# building it:
+# Verify that scons prints an error message
+# if a target can not be unlinked before building it:
test.write('f1.c', r"""
#include <stdio.h>
""")
os.chmod(test.workpath('.'), 0555)
+f = open(test.workpath('f1' + _obj), 'rb')
test.run(arguments = foo1, stderr="scons: *** [Errno 13] Permission denied: 'f1%s'\n"%_obj, status=2)
+f.close()
+
test.pass_test()
env2 = Environment(LIBS = 'foo2',
LIBPATH = '.')
-env2.SharedLibrary(target = 'shlib', source = 'shlib.c')
+env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1)
env2.Library(target = 'foo2', source = f1)
""")
env2 = Environment(LIBS = 'foo2',
LIBPATH = Split('. ./lib2'))
-env2.SharedLibrary(target = 'shlib', source = 'shlib.c')
+env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1)
env2.Library(target = 'foo2', source = f1)
""")
-if sys.platform == 'win32':
-
- test.write('myg77.py', r"""
-import sys
-args = sys.argv[1:]
-inf = None
-while args:
- a = args[0]
- args = args[1:]
- if a[0] != '/':
- if not inf:
- inf = a
- continue
- if a[:3] == '/Fo': out = a[3:]
-infile = open(inf, 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
-""")
-
-else:
-
- test.write('myg77.py', r"""
+test.write('myg77.py', r"""
import getopt
import sys
opts, args = getopt.getopt(sys.argv[1:], 'cf:o:')
-if sys.platform == 'win32':
-
- o = ' -x /c'
-
- test.write('myg77.py', r"""
-import sys
-args = sys.argv[1:]
-inf = None
-optstring = ''
-while args:
- a = args[0]
- args = args[1:]
- if not a[0] in '/-':
- if not inf:
- inf = a
- continue
- if a[:3] == '/Fo':
- out = a[3:]
- continue
- optstring = optstring + ' ' + a
-infile = open(inf, 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
-""")
-
-else:
-
- o = ' -x -c'
-
- test.write('myg77.py', r"""
+test.write('myg77.py', r"""
import getopt
import sys
opts, args = getopt.getopt(sys.argv[1:], 'co:x')
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read('test1' + _obj) != "%s\nThis is a .f file.\n" % o)
+test.fail_test(test.read('test1' + _obj) != " -x -c\nThis is a .f file.\n")
-test.fail_test(test.read('test2' + _obj) != "%s\nThis is a .for file.\n" % o)
+test.fail_test(test.read('test2' + _obj) != " -x -c\nThis is a .for file.\n")
-test.fail_test(test.read('test3' + _obj) != "%s\nThis is a .FOR file.\n" % o)
+test.fail_test(test.read('test3' + _obj) != " -x -c\nThis is a .FOR file.\n")
-test.fail_test(test.read('test4' + _obj) != "%s\nThis is a .F file.\n" % o)
+test.fail_test(test.read('test4' + _obj) != " -x -c\nThis is a .F file.\n")
-test.fail_test(test.read('test5' + _obj) != "%s\nThis is a .fpp file.\n" % o)
+test.fail_test(test.read('test5' + _obj) != " -x -c\nThis is a .fpp file.\n")
-test.fail_test(test.read('test6' + _obj) != "%s\nThis is a .FPP file.\n" % o)
+test.fail_test(test.read('test6' + _obj) != " -x -c\nThis is a .FPP file.\n")
test.write('SConstruct', "")
expect = r"""SCons by Steven Knight et al.:
-\tscript: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+
-\tengine: v\d\.\d\d\.\S+, \d\d\d\d/\d\d/\d\d \d\d:\d\d:\d\d, by \S+ on \S+
+\tscript: v\S+, [^,]*, by \S+ on \S+
+\tengine: v\S+, [^,]*, by \S+ on \S+
Copyright 2001, 2002 Steven Knight
"""
test.subdir('src', 'build', 'include', 'src2')
test.write('src/SConstruct', """
-env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_INCFLAGS /c ${SOURCES.abspath} /Fo$TARGET')
+env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS /c ${SOURCES.abspath} /Fo$TARGET')
foo=env.Object('../build/foo', 'foo.c')
Default(env.Library('../build/foo', foo))
-Default(env.Library('../build/bar', 'bar.c', shared=1))
+Default(env.SharedLibrary('../build/bar', 'bar.c'))
Default(env.Program('../build/bar', ['main.c', '../src2/blat.c', '../build/bar.lib']))
""")