Fix bare 'except:' to placate errors in new flake8 version.
- fixes E722 errors from latest version of flake8 - requires us to not use 'bare except:' and catch BaseException instead
This commit is contained in:
@@ -177,6 +177,6 @@ def install(self, spec, prefix):
|
||||
shutil.copy2(filepath, tmppath)
|
||||
os.remove(filepath)
|
||||
os.rename(tmppath, filepath)
|
||||
except:
|
||||
except (IOError, OSError):
|
||||
pass
|
||||
shutil.rmtree(join_path(prefix, "tmp"))
|
||||
|
@@ -184,7 +184,7 @@ def check_install(self, spec):
|
||||
try:
|
||||
check = Executable("./check")
|
||||
output = check(output=str)
|
||||
except:
|
||||
except ProcessError:
|
||||
output = ""
|
||||
success = output == expected
|
||||
if not success:
|
||||
|
@@ -270,7 +270,7 @@ def check_install(self):
|
||||
try:
|
||||
check = Executable('./check')
|
||||
output = check(output=str)
|
||||
except:
|
||||
except ProcessError:
|
||||
output = ""
|
||||
success = output == expected
|
||||
if not success:
|
||||
|
@@ -63,7 +63,7 @@ def edit(self, spec, prefix):
|
||||
for dep in ("blas", "lapack"):
|
||||
try: # in case the dependency does not provide header flags
|
||||
header_flags += " " + spec[dep].headers.cpp_flags
|
||||
except:
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
make_inc.filter("CFLAGS +[+]=", "CFLAGS += " + header_flags + " ")
|
||||
|
@@ -285,7 +285,7 @@ def _save_distutil_vars(self, prefix):
|
||||
Python._DISTUTIL_CACHE_FILENAME)
|
||||
with open(output_filename, 'w') as output_file:
|
||||
sjson.dump(self._distutil_vars, output_file)
|
||||
except:
|
||||
except Exception:
|
||||
tty.warn("Failed to save metadata for distutils. This might "
|
||||
"cause the extensions that are installed with "
|
||||
"distutils to call compilers directly avoiding "
|
||||
@@ -308,7 +308,7 @@ def _load_distutil_vars(self):
|
||||
if os.path.isfile(input_filename):
|
||||
with open(input_filename) as input_file:
|
||||
self._distutil_vars = sjson.load(input_file)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if not self._distutil_vars:
|
||||
|
Reference in New Issue
Block a user