diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-04-23 14:55:02 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-04-29 12:16:06 +0200 |
commit | bf98ffca9ee67a6a942b9abf96b536692370cf03 (patch) | |
tree | d46378781f8ee4bf288f4c47de6ebc2b618a2d14 | |
parent | ccc4ce28cc9077d77a0bc9e72b1177eba1be7186 (diff) | |
download | meson-bf98ffca9ee67a6a942b9abf96b536692370cf03.zip meson-bf98ffca9ee67a6a942b9abf96b536692370cf03.tar.gz meson-bf98ffca9ee67a6a942b9abf96b536692370cf03.tar.bz2 |
Fix blind exceptions
-rw-r--r-- | mesonbuild/ast/introspection.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 2 | ||||
-rw-r--r-- | mesonbuild/minstall.py | 2 | ||||
-rw-r--r-- | mesonbuild/scripts/depfixer.py | 2 | ||||
-rw-r--r-- | mesonbuild/wrap/wrap.py | 2 | ||||
-rwxr-xr-x | run_project_tests.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 6 | ||||
-rw-r--r-- | sideci.yml | 2 |
9 files changed, 12 insertions, 10 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index 49d531f..34e3e09 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -122,7 +122,7 @@ class IntrospectionInterpreter(AstInterpreter): subi.analyze() subi.project_data['name'] = dirname self.project_data['subprojects'] += [subi.project_data] - except: + except (mesonlib.MesonException, RuntimeError): return def func_add_languages(self, node, args, kwargs): diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 54ca894..8da0518 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -1036,7 +1036,7 @@ class CCompiler(Compiler): elf_class = 2 else: elf_class = 1 - except: + except (MesonException, KeyError): # TODO evaluate if catching KeyError is wanted here elf_class = 0 # Search in the specified dirs, and then in the system libraries for d in itertools.chain(extra_dirs, self.get_library_dirs(env, elf_class)): diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 6063fd3..313f2a0 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -1107,7 +1107,7 @@ class CMakeDependency(ExternalDependency): for l in lexer1: if l.func == 'set': self._cmake_set(l) - except: + except MesonException: return None # Extract the variables and sanity check them diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index c6b6bbf..04aba2f 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -93,7 +93,7 @@ def set_chown(path, user=None, group=None, dir_fd=None, follow_symlinks=True): dir_fd=dir_fd, follow_symlinks=follow_symlinks) shutil.chown(path, user, group) - except: + except Exception: raise finally: os.chown = real_os_chown diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py index 7294186..19fe0fe 100644 --- a/mesonbuild/scripts/depfixer.py +++ b/mesonbuild/scripts/depfixer.py @@ -123,7 +123,7 @@ class Elf(DataSizes): self.parse_header() self.parse_sections() self.parse_dynamic() - except: + except (struct.error, RuntimeError): self.bf.close() raise diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 4d9d032..4a5d726 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -84,7 +84,7 @@ class PackageDefinition: try: self.config = configparser.ConfigParser(interpolation=None) self.config.read(fname) - except: + except configparser.Error: raise WrapException('Failed to parse {}'.format(self.basename)) if len(self.config.sections()) < 1: raise WrapException('Missing sections in {}'.format(self.basename)) diff --git a/run_project_tests.py b/run_project_tests.py index c1d42fc..8fb351c 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -774,7 +774,7 @@ def detect_system_compiler(): try: comp = env.compiler_from_language(lang, env.is_cross_build()) details = '%s %s' % (' '.join(comp.get_exelist()), comp.get_version_string()) - except: + except mesonlib.MesonException: comp = None details = 'not found' print('%-7s: %s' % (lang, details)) diff --git a/run_unittests.py b/run_unittests.py index 2457a50..ab7ad04 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1244,7 +1244,7 @@ class BasePlatformTests(unittest.TestCase): print('Stderr:\n') print(err) raise RuntimeError('Configure failed') - except: + except Exception: self._print_meson_log() raise finally: @@ -1257,7 +1257,7 @@ class BasePlatformTests(unittest.TestCase): out = self._run(self.setup_command + args + extra_args) except unittest.SkipTest: raise unittest.SkipTest('Project requested skipping: ' + srcdir) - except: + except Exception: self._print_meson_log() raise return out @@ -4443,7 +4443,7 @@ class LinuxlikeTests(BasePlatformTests): self.assertIn(cmd_std, cmd) try: self.build() - except: + except Exception: print('{} was {!r}'.format(lang_std, v)) raise self.wipe() @@ -1,3 +1,5 @@ linter: flake8: version: 3 + plugins: + - flake8-blind-except |