diff options
author | Taiju Tsuiki <tzik@users.noreply.github.com> | 2017-10-25 07:13:04 +0900 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2017-10-24 15:13:04 -0700 |
commit | de4b36f88138637132f428789187cde9fb499dd2 (patch) | |
tree | 8753a6995ab87ab26b47a00f22410e534a5918fa /scripts/test/shared.py | |
parent | a26b8ce4e37ebf0ddf5f59ee8cd35e6177d16db3 (diff) | |
download | binaryen-de4b36f88138637132f428789187cde9fb499dd2.tar.gz binaryen-de4b36f88138637132f428789187cde9fb499dd2.tar.bz2 binaryen-de4b36f88138637132f428789187cde9fb499dd2.zip |
Fix flake8 failures in scripts/ (#1239)
flake8 starts warning on bare "except:" in python scripts, and all CI job is failing for that.
Diffstat (limited to 'scripts/test/shared.py')
-rw-r--r-- | scripts/test/shared.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 915cd65e8..65f1f6e74 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -240,7 +240,7 @@ def setup_waterfall(): subprocess.check_call([CLANG, '-v']) has_vanilla_llvm = True print '...success' - except Exception, e: + except (OSError, subprocess.CalledProcessError) as e: warn('could not run vanilla LLVM from waterfall: ' + str(e) + ', looked for clang at ' + CLANG) @@ -256,25 +256,31 @@ if options.only_prepare: # external tools try: - subprocess.check_call( - [NODEJS, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -except: + if NODEJS is not None: + subprocess.check_call( + [NODEJS, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) +except (OSError, subprocess.CalledProcessError): NODEJS = None +if NODEJS is None: warn('no node found (did not check proper js form)') try: - subprocess.check_call( - [MOZJS, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -except: + if MOZJS is not None: + subprocess.check_call( + [MOZJS, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) +except (OSError, subprocess.CalledProcessError): MOZJS = None +if MOZJS is None: warn('no mozjs found (did not check native wasm support nor asm.js' ' validation)') try: - subprocess.check_call( - [EMCC, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -except: + if EMCC is not None: + subprocess.check_call( + [EMCC, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) +except (OSError, subprocess.CalledProcessError): EMCC = None +if EMCC is None: warn('no emcc found (did not check non-vanilla emscripten/binaryen' ' integration)') @@ -284,7 +290,7 @@ try: [os.path.join(options.binaryen_test, 'emscripten', 'emcc'), '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) has_vanilla_emcc = True -except: +except (OSError, subprocess.CalledProcessError): pass @@ -294,13 +300,13 @@ except: def delete_from_orbit(filename): try: os.unlink(filename) - except: + except OSError: pass if not os.path.exists(filename): return try: shutil.rmtree(filename, ignore_errors=True) - except: + except OSError: pass if not os.path.exists(filename): return @@ -315,7 +321,7 @@ def delete_from_orbit(filename): else: raise shutil.rmtree(filename, onerror=remove_readonly_and_try_again) - except: + except OSError: pass |