Use specific exception types instead of Exception

pull/3205/head
Aleksey Filippov 7 years ago
parent 093bdcafc9
commit 3493a372e2
  1. 2
      mesonbuild/scripts/meson_install.py
  2. 4
      test cases/common/72 build always/version_gen.py

@ -283,7 +283,7 @@ def run_install_script(d):
rc = subprocess.call(script + args, env=child_env)
if rc != 0:
sys.exit(rc)
except Exception:
except OSError:
print('Failed to run install script {!r}'.format(name))
sys.exit(1)

@ -8,7 +8,7 @@ def generate(infile, outfile, fallback):
workdir = '.'
try:
version = subprocess.check_output(['git', 'describe'], cwd=workdir).decode().strip()
except Exception:
except (subprocess.CalledProcessError, OSError, UnicodeDecodeError):
version = fallback
with open(infile) as f:
newdata = f.read().replace('@VERSION@', version)
@ -17,7 +17,7 @@ def generate(infile, outfile, fallback):
olddata = f.read()
if olddata == newdata:
return
except Exception:
except OSError:
pass
with open(outfile, 'w') as f:
f.write(newdata)

Loading…
Cancel
Save