Use except Exception where Py2/3 disagrees

This commit is contained in:
Kagami Sascha Rosylight 2020-06-21 04:30:23 +02:00
parent d01648d637
commit 57eed5baa4
4 changed files with 6 additions and 6 deletions

View file

@ -475,7 +475,7 @@ class MachCommands(CommandBase):
if os.path.exists(crate_path): if os.path.exists(crate_path):
try: try:
delete(crate_path) delete(crate_path)
except (FileNotFoundError, PermissionError): except Exception:
print(traceback.format_exc()) print(traceback.format_exc())
print("Delete %s failed!" % crate_path) print("Delete %s failed!" % crate_path)
else: else:

View file

@ -920,7 +920,7 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
for gst_lib in gst_dlls: for gst_lib in gst_dlls:
try: try:
shutil.copy(path.join(gst_root, "bin", gst_lib), servo_exe_dir) shutil.copy(path.join(gst_root, "bin", gst_lib), servo_exe_dir)
except FileNotFoundError: except Exception:
missing += [str(gst_lib)] missing += [str(gst_lib)]
for gst_lib in missing: for gst_lib in missing:
@ -976,7 +976,7 @@ def package_gstreamer_dlls(env, servo_exe_dir, target, uwp):
for gst_lib in gst_dlls: for gst_lib in gst_dlls:
try: try:
shutil.copy(path.join(gst_plugin_path, gst_lib), servo_exe_dir) shutil.copy(path.join(gst_plugin_path, gst_lib), servo_exe_dir)
except FileNotFoundError: except Exception:
missing += [str(gst_lib)] missing += [str(gst_lib)]
for gst_lib in missing: for gst_lib in missing:

View file

@ -537,7 +537,7 @@ class CommandBase(object):
try: try:
if check_gstreamer_lib(): if check_gstreamer_lib():
return False return False
except (FileNotFoundError, WindowsError): except Exception:
# Some systems don't have pkg-config; we can't probe in this case # Some systems don't have pkg-config; we can't probe in this case
# and must hope for the best # and must hope for the best
return False return False

View file

@ -26,13 +26,13 @@ here = os.path.dirname(os.path.abspath(__file__))
try: try:
with open(os.path.join(here, 'README.rst')) as doc: with open(os.path.join(here, 'README.rst')) as doc:
readme = doc.read() readme = doc.read()
except FileNotFoundError: except Exception:
readme = '' readme = ''
try: try:
with open(os.path.join(here, 'HISTORY.rst')) as doc: with open(os.path.join(here, 'HISTORY.rst')) as doc:
history = doc.read() history = doc.read()
except FileNotFoundError: except Exception:
history = '' history = ''
long_description = readme + '\n\n' + history long_description = readme + '\n\n' + history