aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-01-17 13:30:54 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-01-17 15:39:01 +0530
commite441a7428240995cc85c695189f01e757f01f610 (patch)
tree6faad9ca1902ae031408e6c27b207ade44a18a03
parent11f9425a5e123e7e4bb6296f4453a8e072eb95ed (diff)
downloadmeson-e441a7428240995cc85c695189f01e757f01f610.zip
meson-e441a7428240995cc85c695189f01e757f01f610.tar.gz
meson-e441a7428240995cc85c695189f01e757f01f610.tar.bz2
Derive all exceptions correctly from base exceptions
Don't need to define __init__ and manually call the parent init. Doing so messes up the error message you get by doing str(exception) because it includes the current class name in it repeatedly.
-rw-r--r--mesonbuild/dependencies.py8
-rw-r--r--mesonbuild/mesonlib.py6
2 files changed, 5 insertions, 9 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index e77abb8..e11fd57 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -30,8 +30,7 @@ from . import mesonlib
from .environment import detect_cpu_family, for_windows
class DependencyException(MesonException):
- def __init__(self, *args, **kwargs):
- MesonException.__init__(self, *args, **kwargs)
+ '''Exceptions raised while trying to find dependencies'''
class Dependency():
def __init__(self, type_name='unknown'):
@@ -170,9 +169,8 @@ class PkgConfigDependency(Dependency):
if not self.silent:
mlog.log(*found_msg)
if self.required:
- raise DependencyException(
- 'Invalid version of a dependency, needed %s %s found %s.' %
- (name, not_found, self.modversion))
+ m = 'Invalid version of dependency, need {!r} {!r} found {!r}.'
+ raise DependencyException(m.format(name, not_found, self.modversion))
return
found_msg += [mlog.green('YES'), self.modversion]
if not self.silent:
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index c4f6769..685efc5 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -19,12 +19,10 @@ import platform, subprocess, operator, os, shutil, re
from glob import glob
class MesonException(Exception):
- def __init__(self, *args, **kwargs):
- Exception.__init__(self, *args, **kwargs)
+ '''Exceptions thrown by Meson'''
class EnvironmentException(MesonException):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
+ '''Exceptions thrown while processing and creating the build environment'''
class File:
def __init__(self, is_built, subdir, fname):