summaryrefslogtreecommitdiff
path: root/test/Fortran
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-11-27 21:27:10 -0500
committerWilliam Blevins <wblevins001@gmail.com>2016-11-27 21:27:10 -0500
commit9dcdab8bda6c975a3c4965179cc9bbacbbae3e1a (patch)
tree52c998b0a8faf434f306c5498199e6ba468ff261 /test/Fortran
parent8c1bbc45bbdc236867221ca2e17b2f7257c9bad8 (diff)
downloadscons-9dcdab8bda6c975a3c4965179cc9bbacbbae3e1a.tar.gz
Python3 test fixes for Fortran/Side-effect.
Diffstat (limited to 'test/Fortran')
-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
42 files changed, 128 insertions, 630 deletions
diff --git a/test/Fortran/F03.py b/test/Fortran/F03.py
index 3c6bba4a..61688c31 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 b1d2b939..9f1a031e 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 44be880d..d84b0897 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 4e99db80..a0310057 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 a28389e4..3b08f6e7 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 41059afe..5b078b18 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 e53cee1a..955d64a6 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 c693c829..f91765b7 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 8fdd3917..cea0485b 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 1715ce98..26cf30c6 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 1938af18..7a000fec 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 9b4c56c6..d4e6e8a0 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 633b1748..817a7352 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 47da08ee..a7475701 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 7039530c..111c42b2 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 cf2b3b38..607ef609 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 0912f71f..07d1dc32 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 8643a249..ac563cc0 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 d267a243..c6691e8f 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 cc5a5e36..dd542f12 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 577421e4..379dfe90 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 e4b61921..5294836a 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 79231ac9..141fc31a 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 7b9f7d79..6ef2d72d 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 3c146323..723efaf0 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 2791b916..6b3b3d8e 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 9673e6f9..c1b34553 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 d514f645..5327c4cc 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 0aed8589..10f93141 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 3c2565b5..ba3ac2ec 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 1b9628c6..e3f78a80 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 46bf4ae6..c56772e7 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..6f7ee00a 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 6329c9e0..ff0604b6 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 e573eb4a..45c37bc1 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 fdcba7fa..21557360 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 7067c6f0..70c353bc 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 8f537dde..0d78e7ad 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 00000000..08d14891
--- /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 00000000..b972e358
--- /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 00000000..e69de29b
--- /dev/null
+++ b/test/Fortran/fixture/sconstest.skip
diff --git a/test/Fortran/module-subdir.py b/test/Fortran/module-subdir.py
index def1e5cb..6570e0f2 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')