summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-11-28 02:27:10 (GMT)
committerWilliam Blevins <wblevins001@gmail.com>2016-11-28 02:27:10 (GMT)
commit51abbd22089b2274161ee95d48d00525d7905b01 (patch)
tree52c998b0a8faf434f306c5498199e6ba468ff261
parente3d5fdee7267b8e07873f77afe4f2ecc46f82f16 (diff)
downloadSCons-51abbd22089b2274161ee95d48d00525d7905b01.zip
SCons-51abbd22089b2274161ee95d48d00525d7905b01.tar.gz
SCons-51abbd22089b2274161ee95d48d00525d7905b01.tar.bz2
Python3 test fixes for Fortran/Side-effect.
-rwxr-xr-xruntest.py2
-rw-r--r--test/Fortran/F03.py18
-rw-r--r--test/Fortran/F03FILESUFFIXES.py17
-rw-r--r--test/Fortran/F03FILESUFFIXES2.py17
-rw-r--r--test/Fortran/F03FLAGS.py26
-rw-r--r--test/Fortran/F08.py18
-rw-r--r--test/Fortran/F08FILESUFFIXES.py17
-rw-r--r--test/Fortran/F08FILESUFFIXES2.py17
-rw-r--r--test/Fortran/F08FLAGS.py26
-rw-r--r--test/Fortran/F77.py17
-rw-r--r--test/Fortran/F77FILESUFFIXES.py17
-rw-r--r--test/Fortran/F77FILESUFFIXES2.py17
-rw-r--r--test/Fortran/F77FLAGS.py23
-rw-r--r--test/Fortran/F90.py18
-rw-r--r--test/Fortran/F90FILESUFFIXES.py17
-rw-r--r--test/Fortran/F90FILESUFFIXES2.py17
-rw-r--r--test/Fortran/F90FLAGS.py27
-rw-r--r--test/Fortran/F95.py20
-rw-r--r--test/Fortran/F95FILESUFFIXES.py19
-rw-r--r--test/Fortran/F95FILESUFFIXES2.py19
-rw-r--r--test/Fortran/F95FLAGS.py28
-rw-r--r--test/Fortran/FORTRAN.py20
-rw-r--r--test/Fortran/FORTRANFILESUFFIXES.py19
-rw-r--r--test/Fortran/FORTRANFILESUFFIXES2.py19
-rw-r--r--test/Fortran/FORTRANFLAGS.py25
-rw-r--r--test/Fortran/FORTRANMODDIR.py2
-rw-r--r--test/Fortran/FORTRANPPFILESUFFIXES.py7
-rw-r--r--test/Fortran/FORTRANSUFFIXES.py2
-rw-r--r--test/Fortran/SHF03.py20
-rw-r--r--test/Fortran/SHF08.py20
-rw-r--r--test/Fortran/SHF77.py20
-rw-r--r--test/Fortran/SHF77FLAGS.py25
-rw-r--r--test/Fortran/SHF90.py20
-rw-r--r--test/Fortran/SHF90FLAGS.py28
-rw-r--r--test/Fortran/SHF95.py20
-rw-r--r--test/Fortran/SHF95FLAGS.py28
-rw-r--r--test/Fortran/SHFORTRAN.py21
-rw-r--r--test/Fortran/SHFORTRANFLAGS.py25
-rw-r--r--test/Fortran/USE-MODULE.py2
-rw-r--r--test/Fortran/fixture/myfortran.py14
-rw-r--r--test/Fortran/fixture/myfortran_flags.py16
-rw-r--r--test/Fortran/fixture/sconstest.skip0
-rw-r--r--test/Fortran/module-subdir.py10
-rw-r--r--test/SideEffect/basic.py2
-rw-r--r--test/SideEffect/parallel.py4
-rw-r--r--test/SideEffect/variant_dir.py2
46 files changed, 133 insertions, 635 deletions
diff --git a/runtest.py b/runtest.py
index d636b73..cfdc0c9 100755
--- a/runtest.py
+++ b/runtest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# __COPYRIGHT__
#
diff --git a/test/Fortran/F03.py b/test/Fortran/F03.py
index 3c6bba4..61688c3 100644
--- a/test/Fortran/F03.py
+++ b/test/Fortran/F03.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,22 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-length = len(comment)
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:length] != comment.encode():
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
diff --git a/test/Fortran/F03FILESUFFIXES.py b/test/Fortran/F03FILESUFFIXES.py
index b1d2b93..9f1a031 100644
--- a/test/Fortran/F03FILESUFFIXES.py
+++ b/test/Fortran/F03FILESUFFIXES.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f90/.F90 for F90
test.write('SConstruct', """
diff --git a/test/Fortran/F03FILESUFFIXES2.py b/test/Fortran/F03FILESUFFIXES2.py
index 44be880..d84b089 100644
--- a/test/Fortran/F03FILESUFFIXES2.py
+++ b/test/Fortran/F03FILESUFFIXES2.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non-default file suffix: .f/.F for F03
test.write('SConstruct', """
diff --git a/test/Fortran/F03FLAGS.py b/test/Fortran/F03FLAGS.py
index 4e99db8..a031005 100644
--- a/test/Fortran/F03FLAGS.py
+++ b/test/Fortran/F03FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,33 +33,14 @@ test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- F03 = r'%(_python_)s myfortran.py g03',
+ F03 = r'%(_python_)s myfortran_flags.py g03',
F03FLAGS = '-x',
- FORTRAN = r'%(_python_)s myfortran.py fortran',
+ FORTRAN = r'%(_python_)s myfortran_flags.py fortran',
FORTRANFLAGS = '-y')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/F08.py b/test/Fortran/F08.py
index a28389e..3b08f6e 100644
--- a/test/Fortran/F08.py
+++ b/test/Fortran/F08.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,22 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-length = len(comment)
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:length] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
diff --git a/test/Fortran/F08FILESUFFIXES.py b/test/Fortran/F08FILESUFFIXES.py
index 41059af..5b078b1 100644
--- a/test/Fortran/F08FILESUFFIXES.py
+++ b/test/Fortran/F08FILESUFFIXES.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f90/.F90 for F90
test.write('SConstruct', """
diff --git a/test/Fortran/F08FILESUFFIXES2.py b/test/Fortran/F08FILESUFFIXES2.py
index e53cee1..955d64a 100644
--- a/test/Fortran/F08FILESUFFIXES2.py
+++ b/test/Fortran/F08FILESUFFIXES2.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non-default file suffix: .f/.F for F08
test.write('SConstruct', """
diff --git a/test/Fortran/F08FLAGS.py b/test/Fortran/F08FLAGS.py
index c693c82..f91765b 100644
--- a/test/Fortran/F08FLAGS.py
+++ b/test/Fortran/F08FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,33 +33,14 @@ test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- F08 = r'%(_python_)s myfortran.py g08',
+ F08 = r'%(_python_)s myfortran_flags.py g08',
F08FLAGS = '-x',
- FORTRAN = r'%(_python_)s myfortran.py fortran',
+ FORTRAN = r'%(_python_)s myfortran_flags.py fortran',
FORTRANFLAGS = '-y')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/F77.py b/test/Fortran/F77.py
index 8fdd391..cea0485 100644
--- a/test/Fortran/F77.py
+++ b/test/Fortran/F77.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
diff --git a/test/Fortran/F77FILESUFFIXES.py b/test/Fortran/F77FILESUFFIXES.py
index 1715ce9..26cf30c 100644
--- a/test/Fortran/F77FILESUFFIXES.py
+++ b/test/Fortran/F77FILESUFFIXES.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f77/.F77 for F77
test.write('SConstruct', """
diff --git a/test/Fortran/F77FILESUFFIXES2.py b/test/Fortran/F77FILESUFFIXES2.py
index 1938af1..7a000fe 100644
--- a/test/Fortran/F77FILESUFFIXES2.py
+++ b/test/Fortran/F77FILESUFFIXES2.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non-default file suffix: .f/.F for F77
test.write('SConstruct', """
diff --git a/test/Fortran/F77FLAGS.py b/test/Fortran/F77FLAGS.py
index 9b4c56c..d4e6e8a 100644
--- a/test/Fortran/F77FLAGS.py
+++ b/test/Fortran/F77FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,30 +33,12 @@ test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myg77.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'co:x')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- F77 = r'%(_python_)s myg77.py',
+ F77 = r'%(_python_)s myfortran_flags.py g77',
F77FLAGS = '-x')
env.Program(target = 'test09', source = 'test09.f77')
env.Program(target = 'test10', source = 'test10.F77')
diff --git a/test/Fortran/F90.py b/test/Fortran/F90.py
index 633b174..817a735 100644
--- a/test/Fortran/F90.py
+++ b/test/Fortran/F90.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,22 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-length = len(comment)
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:length] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
diff --git a/test/Fortran/F90FILESUFFIXES.py b/test/Fortran/F90FILESUFFIXES.py
index 47da08e..a747570 100644
--- a/test/Fortran/F90FILESUFFIXES.py
+++ b/test/Fortran/F90FILESUFFIXES.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f90/.F90 for F90
test.write('SConstruct', """
diff --git a/test/Fortran/F90FILESUFFIXES2.py b/test/Fortran/F90FILESUFFIXES2.py
index 7039530..111c42b 100644
--- a/test/Fortran/F90FILESUFFIXES2.py
+++ b/test/Fortran/F90FILESUFFIXES2.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,21 +33,7 @@ _exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non-default file suffix: .f/.F for F90
test.write('SConstruct', """
diff --git a/test/Fortran/F90FLAGS.py b/test/Fortran/F90FLAGS.py
index cf2b3b3..607ef60 100644
--- a/test/Fortran/F90FLAGS.py
+++ b/test/Fortran/F90FLAGS.py
@@ -25,42 +25,23 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- F90 = r'%(_python_)s myfortran.py g90',
+ F90 = r'%(_python_)s myfortran_flags.py g90',
F90FLAGS = '-x',
- FORTRAN = r'%(_python_)s myfortran.py fortran',
+ FORTRAN = r'%(_python_)s myfortran_flags.py fortran',
FORTRANFLAGS = '-y')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/F95.py b/test/Fortran/F95.py
index 0912f71..07d1dc3 100644
--- a/test/Fortran/F95.py
+++ b/test/Fortran/F95.py
@@ -24,32 +24,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-length = len(comment)
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:length] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
diff --git a/test/Fortran/F95FILESUFFIXES.py b/test/Fortran/F95FILESUFFIXES.py
index 8643a24..ac563cc 100644
--- a/test/Fortran/F95FILESUFFIXES.py
+++ b/test/Fortran/F95FILESUFFIXES.py
@@ -24,31 +24,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f90/.F90 for F90
test.write('SConstruct', """
diff --git a/test/Fortran/F95FILESUFFIXES2.py b/test/Fortran/F95FILESUFFIXES2.py
index d267a24..c6691e8 100644
--- a/test/Fortran/F95FILESUFFIXES2.py
+++ b/test/Fortran/F95FILESUFFIXES2.py
@@ -24,31 +24,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non-default file suffix: .f/.F for F95
test.write('SConstruct', """
diff --git a/test/Fortran/F95FLAGS.py b/test/Fortran/F95FLAGS.py
index cc5a5e3..dd542f1 100644
--- a/test/Fortran/F95FLAGS.py
+++ b/test/Fortran/F95FLAGS.py
@@ -24,43 +24,23 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- F95 = r'%(_python_)s myfortran.py g95',
+ F95 = r'%(_python_)s myfortran_flags.py g95',
F95FLAGS = '-x',
- FORTRAN = r'%(_python_)s myfortran.py fortran',
+ FORTRAN = r'%(_python_)s myfortran_flags.py fortran',
FORTRANFLAGS = '-y')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/FORTRAN.py b/test/Fortran/FORTRAN.py
index 577421e..379dfe9 100644
--- a/test/Fortran/FORTRAN.py
+++ b/test/Fortran/FORTRAN.py
@@ -24,35 +24,21 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myg77.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- FORTRAN = r'%(_python_)s myg77.py')
+ FORTRAN = r'%(_python_)s myfortran.py g77')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
env.Program(target = 'test03', source = 'test03.for')
diff --git a/test/Fortran/FORTRANFILESUFFIXES.py b/test/Fortran/FORTRANFILESUFFIXES.py
index e4b6192..5294836 100644
--- a/test/Fortran/FORTRANFILESUFFIXES.py
+++ b/test/Fortran/FORTRANFILESUFFIXES.py
@@ -24,31 +24,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test default file suffix: .f/.F for FORTRAN
test.write('SConstruct', """
diff --git a/test/Fortran/FORTRANFILESUFFIXES2.py b/test/Fortran/FORTRANFILESUFFIXES2.py
index 79231ac..141fc31 100644
--- a/test/Fortran/FORTRANFILESUFFIXES2.py
+++ b/test/Fortran/FORTRANFILESUFFIXES2.py
@@ -24,31 +24,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
_exe = TestSCons._exe
test = TestSCons.TestSCons()
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'co:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
# Test non default file suffix: .f, .f90 and .f95 for FORTRAN
test.write('SConstruct', """
diff --git a/test/Fortran/FORTRANFLAGS.py b/test/Fortran/FORTRANFLAGS.py
index 7b9f7d7..6ef2d72 100644
--- a/test/Fortran/FORTRANFLAGS.py
+++ b/test/Fortran/FORTRANFLAGS.py
@@ -24,40 +24,21 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
-
-
_python_ = TestSCons._python_
test = TestSCons.TestSCons()
_exe = TestSCons._exe
test.file_fixture('mylink.py')
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'co:x')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- else: optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:8] != '#fortran':
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
env = Environment(LINK = r'%(_python_)s mylink.py',
LINKFLAGS = [],
- FORTRAN = r'%(_python_)s myfortran.py',
+ FORTRAN = r'%(_python_)s myfortran_flags.py fortran',
FORTRANFLAGS = '-x')
env.Program(target = 'test01', source = 'test01.f')
env.Program(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/FORTRANMODDIR.py b/test/Fortran/FORTRANMODDIR.py
index 3c14632..723efaf 100644
--- a/test/Fortran/FORTRANMODDIR.py
+++ b/test/Fortran/FORTRANMODDIR.py
@@ -42,7 +42,7 @@ contents = open(sys.argv[2]).read()
modules = re.findall(mod_regex, contents)
modules = [os.path.join(sys.argv[1], m.lower()+'.mod') for m in modules]
for t in sys.argv[3:] + modules:
- open(t, 'wb').write('myfortran.py wrote %s\n' % os.path.split(t)[1])
+ open(t, 'wb').write(('myfortran.py wrote %s\n' % os.path.split(t)[1]).encode())
sys.exit(0)
""")
diff --git a/test/Fortran/FORTRANPPFILESUFFIXES.py b/test/Fortran/FORTRANPPFILESUFFIXES.py
index 2791b91..6b3b3d8 100644
--- a/test/Fortran/FORTRANPPFILESUFFIXES.py
+++ b/test/Fortran/FORTRANPPFILESUFFIXES.py
@@ -43,7 +43,8 @@ test.write('myfortran.py', r"""
import getopt
import sys
-comment = '#' + sys.argv[1]
+comment = ('#' + sys.argv[1]).encode()
+length = len(comment)
args = sys.argv[2:]
# First parse defines, since getopt won't have it
defines = []
@@ -58,9 +59,9 @@ for opt, arg in opts:
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for d in defines:
- outfile.write("#define %s\n" % (d,))
+ outfile.write(("#define %s\n" % (d,)).encode())
for l in infile.readlines():
- if l[:len(comment)] != comment:
+ if l[:length] != comment:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/FORTRANSUFFIXES.py b/test/Fortran/FORTRANSUFFIXES.py
index 9673e6f..c1b3455 100644
--- a/test/Fortran/FORTRANSUFFIXES.py
+++ b/test/Fortran/FORTRANSUFFIXES.py
@@ -38,7 +38,7 @@ test.write('myfc.py', r"""
import sys
def do_file(outf, inf):
for line in open(inf, 'rb').readlines():
- if line[:15] == " INCLUDE '":
+ if line[:15] == b" INCLUDE '":
do_file(outf, line[15:-2])
else:
outf.write(line)
diff --git a/test/Fortran/SHF03.py b/test/Fortran/SHF03.py
index d514f64..5327c4c 100644
--- a/test/Fortran/SHF03.py
+++ b/test/Fortran/SHF03.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,24 +33,7 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(SHF03 = r'%(_python_)s myfortran.py g03',
diff --git a/test/Fortran/SHF08.py b/test/Fortran/SHF08.py
index 0aed858..10f9314 100644
--- a/test/Fortran/SHF08.py
+++ b/test/Fortran/SHF08.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,24 +33,7 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(SHF08 = r'%(_python_)s myfortran.py g08',
diff --git a/test/Fortran/SHF77.py b/test/Fortran/SHF77.py
index 3c2565b..ba3ac2e 100644
--- a/test/Fortran/SHF77.py
+++ b/test/Fortran/SHF77.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,24 +33,7 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(SHF77 = r'%(_python_)s myfortran.py g77',
diff --git a/test/Fortran/SHF77FLAGS.py b/test/Fortran/SHF77FLAGS.py
index 1b9628c..e3f78a8 100644
--- a/test/Fortran/SHF77FLAGS.py
+++ b/test/Fortran/SHF77FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,30 +33,10 @@ _obj = TestSCons._shobj
obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-
-test.write('myg77.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'cf:K:o:x')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:4] != '#g77':
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
-env = Environment(SHF77 = r'%(_python_)s myg77.py')
+env = Environment(SHF77 = r'%(_python_)s myfortran_flags.py g77')
env.Append(SHF77FLAGS = '-x')
env.SharedObject(target = 'test09', source = 'test09.f77')
env.SharedObject(target = 'test10', source = 'test10.F77')
diff --git a/test/Fortran/SHF90.py b/test/Fortran/SHF90.py
index 46bf4ae..c56772e 100644
--- a/test/Fortran/SHF90.py
+++ b/test/Fortran/SHF90.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,24 +33,7 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(SHF90 = r'%(_python_)s myfortran.py g90',
diff --git a/test/Fortran/SHF90FLAGS.py b/test/Fortran/SHF90FLAGS.py
index 0f9e2ba3..6f7ee00 100644
--- a/test/Fortran/SHF90FLAGS.py
+++ b/test/Fortran/SHF90FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,32 +33,11 @@ _obj = TestSCons._shobj
obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:K:o:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
-env = Environment(SHF90 = r'%(_python_)s myfortran.py g90',
- SHFORTRAN = r'%(_python_)s myfortran.py fortran')
+env = Environment(SHF90 = r'%(_python_)s myfortran_flags.py g90',
+ SHFORTRAN = r'%(_python_)s myfortran_flags.py fortran')
env.Append(SHF90FLAGS = '-x',
SHFORTRANFLAGS = '-y')
env.SharedObject(target = 'test01', source = 'test01.f')
diff --git a/test/Fortran/SHF95.py b/test/Fortran/SHF95.py
index 6329c9e..ff0604b 100644
--- a/test/Fortran/SHF95.py
+++ b/test/Fortran/SHF95.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,24 +33,7 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
env = Environment(SHF95 = r'%(_python_)s myfortran.py g95',
diff --git a/test/Fortran/SHF95FLAGS.py b/test/Fortran/SHF95FLAGS.py
index e573eb4..45c37bc 100644
--- a/test/Fortran/SHF95FLAGS.py
+++ b/test/Fortran/SHF95FLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,32 +33,11 @@ _obj = TestSCons._shobj
obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-comment = '#' + sys.argv[1]
-opts, args = getopt.getopt(sys.argv[2:], 'cf:K:o:xy')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:len(comment)] != comment:
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
-env = Environment(SHF95 = r'%(_python_)s myfortran.py g95',
- SHFORTRAN = r'%(_python_)s myfortran.py fortran')
+env = Environment(SHF95 = r'%(_python_)s myfortran_flags.py g95',
+ SHFORTRAN = r'%(_python_)s myfortran_flags.py fortran')
env.Append(SHF95FLAGS = '-x',
SHFORTRANFLAGS = '-y')
env.SharedObject(target = 'test01', source = 'test01.f')
diff --git a/test/Fortran/SHFORTRAN.py b/test/Fortran/SHFORTRAN.py
index fdcba7f..2155736 100644
--- a/test/Fortran/SHFORTRAN.py
+++ b/test/Fortran/SHFORTRAN.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -32,26 +33,10 @@ obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'cf:o:K:')
-for opt, arg in opts:
- if opt == '-o': out = arg
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-for l in infile.readlines():
- if l[:8] != '#fortran':
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran.py'))
test.write('SConstruct', """
-env = Environment(SHFORTRAN = r'%(_python_)s myfortran.py')
+env = Environment(SHFORTRAN = r'%(_python_)s myfortran.py fortran')
env.SharedObject(target = 'test01', source = 'test01.f')
env.SharedObject(target = 'test02', source = 'test02.F')
env.SharedObject(target = 'test03', source = 'test03.for')
diff --git a/test/Fortran/SHFORTRANFLAGS.py b/test/Fortran/SHFORTRANFLAGS.py
index 7067c6f..70c353b 100644
--- a/test/Fortran/SHFORTRANFLAGS.py
+++ b/test/Fortran/SHFORTRANFLAGS.py
@@ -24,6 +24,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os
import TestSCons
_python_ = TestSCons._python_
@@ -31,30 +32,10 @@ _obj = TestSCons._shobj
obj_ = TestSCons.shobj_
test = TestSCons.TestSCons()
-
-
-
-test.write('myfortran.py', r"""
-import getopt
-import sys
-opts, args = getopt.getopt(sys.argv[1:], 'cf:K:o:x')
-optstring = ''
-for opt, arg in opts:
- if opt == '-o': out = arg
- elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
-infile = open(args[0], 'rb')
-outfile = open(out, 'wb')
-outfile.write(optstring + "\n")
-for l in infile.readlines():
- if l[:8] != '#fortran':
- outfile.write(l)
-sys.exit(0)
-""")
-
-
+test.file_fixture(os.path.join('fixture', 'myfortran_flags.py'))
test.write('SConstruct', """
-env = Environment(SHFORTRAN = r'%(_python_)s myfortran.py')
+env = Environment(SHFORTRAN = r'%(_python_)s myfortran_flags.py fortran')
env.Append(SHFORTRANFLAGS = '-x')
env.SharedObject(target = 'test01', source = 'test01.f')
env.SharedObject(target = 'test02', source = 'test02.F')
diff --git a/test/Fortran/USE-MODULE.py b/test/Fortran/USE-MODULE.py
index 8f537dd..0d78e7a 100644
--- a/test/Fortran/USE-MODULE.py
+++ b/test/Fortran/USE-MODULE.py
@@ -42,7 +42,7 @@ contents = open(sys.argv[1]).read()
modules = re.findall(mod_regex, contents)
modules = [m.lower()+'.mod' for m in modules]
for t in sys.argv[2:] + modules:
- open(t, 'wb').write('myfortran.py wrote %s\n' % os.path.split(t)[1])
+ open(t, 'wb').write(('myfortran.py wrote %s\n' % os.path.split(t)[1]).encode())
sys.exit(0)
""")
diff --git a/test/Fortran/fixture/myfortran.py b/test/Fortran/fixture/myfortran.py
new file mode 100644
index 0000000..08d1489
--- /dev/null
+++ b/test/Fortran/fixture/myfortran.py
@@ -0,0 +1,14 @@
+import getopt
+import sys
+print(sys.argv)
+comment = ('#' + sys.argv[1]).encode()
+length = len(comment)
+opts, args = getopt.getopt(sys.argv[2:], 'cf:o:K:')
+for opt, arg in opts:
+ if opt == '-o': out = arg
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+for l in infile.readlines():
+ if l[:length] != comment:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/Fortran/fixture/myfortran_flags.py b/test/Fortran/fixture/myfortran_flags.py
new file mode 100644
index 0000000..b972e35
--- /dev/null
+++ b/test/Fortran/fixture/myfortran_flags.py
@@ -0,0 +1,16 @@
+import getopt
+import sys
+comment = ('#' + sys.argv[1]).encode()
+opts, args = getopt.getopt(sys.argv[2:], 'cf:o:xy')
+optstring = ''
+length = len(comment)
+for opt, arg in opts:
+ if opt == '-o': out = arg
+ elif opt not in ('-f', '-K'): optstring = optstring + ' ' + opt
+infile = open(args[0], 'rb')
+outfile = open(out, 'wb')
+outfile.write((optstring + "\n").encode())
+for l in infile.readlines():
+ if l[:length] != comment:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/Fortran/fixture/sconstest.skip b/test/Fortran/fixture/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/Fortran/fixture/sconstest.skip
diff --git a/test/Fortran/module-subdir.py b/test/Fortran/module-subdir.py
index def1e5c..6570e0f 100644
--- a/test/Fortran/module-subdir.py
+++ b/test/Fortran/module-subdir.py
@@ -45,7 +45,7 @@ test.write('myfortran.py', r"""
import getopt
import os
import sys
-comment = '#' + sys.argv[1]
+comment = ('#' + sys.argv[1]).encode()
length = len(comment)
opts, args = getopt.getopt(sys.argv[2:], 'cM:o:')
for opt, arg in opts:
@@ -55,9 +55,9 @@ import os
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
- if l[:7] == 'module ':
- module = modsubdir + os.sep + l[7:-1] + '.mod'
- open(module, 'wb').write('myfortran.py wrote %s\n' % module)
+ if l[:7] == b'module ':
+ module = modsubdir + os.sep + l[7:-1].decode() + '.mod'
+ open(module, 'wb').write(('myfortran.py wrote %s\n' % module).encode())
if l[:length] != comment:
outfile.write(l)
sys.exit(0)
@@ -103,7 +103,7 @@ end module
""")
-test.run(arguments = '.')
+test.run(arguments = '. --tree=all')
somemodule = os.path.join('subdir', 'build', 'somemodule.mod')
diff --git a/test/SideEffect/basic.py b/test/SideEffect/basic.py
index 0ded6b6..af6c264 100644
--- a/test/SideEffect/basic.py
+++ b/test/SideEffect/basic.py
@@ -43,7 +43,7 @@ def build(env, source, target):
copy(str(source[0]), str(target[0]))
if target[0].side_effects:
side_effect = open(str(target[0].side_effects[0]), "ab")
- side_effect.write('%%s -> %%s\\n'%%(str(source[0]), str(target[0])))
+ side_effect.write(('%%s -> %%s\\n'%%(str(source[0]), str(target[0]))).encode())
Build = Builder(action=build)
env = Environment(BUILDERS={'Build':Build}, SUBDIR='subdir')
diff --git a/test/SideEffect/parallel.py b/test/SideEffect/parallel.py
index ff883c4..f750903 100644
--- a/test/SideEffect/parallel.py
+++ b/test/SideEffect/parallel.py
@@ -45,14 +45,14 @@ logfile = 'log.txt'
try:
os.mkdir(lockdir)
-except OSError, e:
+except OSError as e:
msg = 'could not create lock directory: %s\\n' % e
sys.stderr.write(msg)
sys.exit(1)
src, target = sys.argv[1:]
-open(logfile, 'ab').write('%s -> %s\\n' % (src, target))
+open(logfile, 'ab').write(('%s -> %s\\n' % (src, target)).encode())
# Give the other threads a chance to start.
time.sleep(1)
diff --git a/test/SideEffect/variant_dir.py b/test/SideEffect/variant_dir.py
index cc7b8e9..711e426 100644
--- a/test/SideEffect/variant_dir.py
+++ b/test/SideEffect/variant_dir.py
@@ -44,7 +44,7 @@ def build(env, source, target):
copy(str(source[0]), str(target[0]))
if target[0].side_effects:
side_effect = open(str(target[0].side_effects[0]), "ab")
- side_effect.write('%s -> %s\\n'%(str(source[0]), str(target[0])))
+ side_effect.write(('%s -> %s\\n'%(str(source[0]), str(target[0]))).encode())
Build = Builder(action=build)
env = Environment(BUILDERS={'Build':Build})