summaryrefslogtreecommitdiff
path: root/test/fixture
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2020-05-19 16:21:58 -0700
committerWilliam Deegan <bill@baddogconsulting.com>2020-05-19 16:21:58 -0700
commit9d1cae7754e208dbb5a45769563eb5581d4b3dd4 (patch)
treec8b645b99d4b3abef29ffeb1593b860c34048b9a /test/fixture
parent97bc344bcb78a8cfbea0e5417b7b461f1d066ce7 (diff)
downloadscons-git-9d1cae7754e208dbb5a45769563eb5581d4b3dd4.tar.gz
more test updates
Diffstat (limited to 'test/fixture')
-rw-r--r--test/fixture/mygcc.py6
-rw-r--r--test/fixture/mylink.py50
-rw-r--r--test/fixture/mylink_win32.py16
3 files changed, 33 insertions, 39 deletions
diff --git a/test/fixture/mygcc.py b/test/fixture/mygcc.py
index 76634cb88..02480eeea 100644
--- a/test/fixture/mygcc.py
+++ b/test/fixture/mygcc.py
@@ -1,15 +1,17 @@
-
import getopt
import os
import sys
+
compiler = sys.argv[1]
clen = len(compiler) + 1
opts, args = getopt.getopt(sys.argv[2:], 'co:xf:K:')
for opt, arg in opts:
- if opt == '-o': out = arg
+ if opt == '-o':
+ out = arg
elif opt == '-x':
with open('mygcc.out', 'a') as f:
f.write(compiler + "\n")
+
with open(out, 'w') as ofp, open(args[0], 'r') as ifp:
for l in ifp.readlines():
if l[:clen] != '#' + compiler:
diff --git a/test/fixture/mylink.py b/test/fixture/mylink.py
index 38d984643..85646a4f5 100644
--- a/test/fixture/mylink.py
+++ b/test/fixture/mylink.py
@@ -1,39 +1,15 @@
-r"""
-Phony "linker" for testing SCons.
-
-Recognizes the option to specify an output file, ignoring
-all others; copies input lines to the output file except
-ones that contain a pattern, so we can recognize the tool
-has made a modification.
-"""
-
+import getopt
import sys
-if __name__ == '__main__':
- if sys.platform == 'win32':
- args = sys.argv[1:]
- while args:
- a = args[0]
- if a == '-o':
- out = args[1]
- args = args[2:]
- continue
- if not a[0] in '/-':
- break
- args = args[1:]
- if a[:5].lower() == '/out:': out = a[5:]
- with open(args[0], 'rb') as ifp, open(out, 'wb') as ofp:
- for line in ifp:
- if not line.startswith(b'#link'):
- ofp.write(line)
- sys.exit(0)
- else:
- import getopt
- opts, args = getopt.getopt(sys.argv[1:], 'o:')
- for opt, arg in opts:
- if opt == '-o': out = arg
- with open(args[0], 'rb') as ifp, open(out, 'wb') as ofp:
- for line in ifp:
- if not line.startswith(b'#link'):
- ofp.write(line)
- sys.exit(0)
+opts, args = getopt.getopt(sys.argv[1:], 'o:s:')
+for opt, arg in opts:
+ if opt == '-o':
+ out = arg
+
+with open(out, 'w') as ofp:
+ for f in args:
+ with open(f, 'r') as ifp:
+ for l in ifp.readlines():
+ if l[:5] != '#link':
+ ofp.write(l)
+sys.exit(0)
diff --git a/test/fixture/mylink_win32.py b/test/fixture/mylink_win32.py
index e69de29bb..438e920a4 100644
--- a/test/fixture/mylink_win32.py
+++ b/test/fixture/mylink_win32.py
@@ -0,0 +1,16 @@
+import sys
+
+args = sys.argv[1:]
+while args:
+ a = args[0]
+ if a[0] != '/':
+ break
+ args.pop(0)
+ if a[:5] == '/OUT:':
+ out = a[5:]
+
+with open(out, 'w') as ofp, open(args[0], 'r') as ifp:
+ for l in ifp.readlines():
+ if l[:5] != '#link':
+ ofp.write(l)
+sys.exit(0)