diff options
author | Mats Wichmann <mats@linux.com> | 2019-04-26 17:10:19 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-04-26 19:11:59 (GMT) |
commit | 15326cf04732bbcc5ef62c5452349a4bd029b70e (patch) | |
tree | 8a7f61381f13838164e43bcb533adf1e5efd93ee /test/AS | |
parent | 0e84c296d686e4384c8e6f5137a7c15e51dcb167 (diff) | |
download | SCons-15326cf04732bbcc5ef62c5452349a4bd029b70e.zip SCons-15326cf04732bbcc5ef62c5452349a4bd029b70e.tar.gz SCons-15326cf04732bbcc5ef62c5452349a4bd029b70e.tar.bz2 |
[PR #3345] fix more PY3.8 fails
File closes in msvs tool
Context manager in rpm tool
Dummy compiler, assembler scripts can be called in unexpected
ways (namely by gcc tool init), which passes --version flag.
don't take exception on the getopt call.
Try again to undo my breakage of _subproc, which was failing on Win+PY27
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/AS')
-rw-r--r-- | test/AS/fixture/myas.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/AS/fixture/myas.py b/test/AS/fixture/myas.py index 4f5d9ac..3d05c79 100644 --- a/test/AS/fixture/myas.py +++ b/test/AS/fixture/myas.py @@ -23,11 +23,16 @@ if sys.platform == 'win32': else: import getopt - opts, args = getopt.getopt(sys.argv[1:], 'co:') + try: + opts, args = getopt.getopt(sys.argv[1:], 'co:') + except getopt.GetoptError: + # we may be called with --version, just quit if so + sys.exit(0) for opt, arg in opts: if opt == '-o': out = arg - with open(args[0], 'rb') as ifp, open(out, 'wb') as ofp: - for l in ifp.readlines(): - if l[:3] != b'#as': - ofp.write(l) + if args: + with open(args[0], 'rb') as ifp, open(out, 'wb') as ofp: + for l in ifp.readlines(): + if l[:3] != b'#as': + ofp.write(l) sys.exit(0) |