Remove unused MesonException.get_msg_with_context()

After that, the only remaining user of get_error_location_string() is mlog,
so move that there.
pull/6627/head
Jon Turney 5 years ago
parent 63d67e2042
commit fa928e803b
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 17
      mesonbuild/mesonlib.py
  2. 11
      mesonbuild/mlog.py

@ -122,13 +122,6 @@ an_unpicklable_object = threading.Lock()
class MesonException(Exception):
'''Exceptions thrown by Meson'''
def get_msg_with_context(self):
s = ''
if hasattr(self, 'lineno') and hasattr(self, 'file'):
s = get_error_location_string(self.file, self.lineno) + ' '
s += str(self)
return s
class EnvironmentException(MesonException):
'''Exceptions thrown while processing and creating the build environment'''
@ -1339,16 +1332,6 @@ def detect_subprojects(spdir_name, current_dir='', result=None):
result[basename] = [trial]
return result
# This isn't strictly correct. What we really want here is something like:
# class StringProtocol(typing_extensions.Protocol):
#
# def __str__(self) -> str: ...
#
# This would more accurately embody what this funcitonc an handle, but we
# don't have that yet, so instead we'll do some casting to work around it
def get_error_location_string(fname: str, lineno: str) -> str:
return '{}:{}:'.format(fname, lineno)
def substring_is_in_list(substr: str, strlist: T.List[str]) -> bool:
for s in strlist:
if substr in s:

@ -221,9 +221,18 @@ def log_once(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
_logged_once.add(t)
log(*args, is_error=is_error, **kwargs)
# This isn't strictly correct. What we really want here is something like:
# class StringProtocol(typing_extensions.Protocol):
#
# def __str__(self) -> str: ...
#
# This would more accurately embody what this funcitonc an handle, but we
# don't have that yet, so instead we'll do some casting to work around it
def get_error_location_string(fname: str, lineno: str) -> str:
return '{}:{}:'.format(fname, lineno)
def _log_error(severity: str, *rargs: T.Union[str, AnsiDecorator],
once: bool = False, **kwargs: T.Any) -> None:
from .mesonlib import get_error_location_string
from .environment import build_filename
from .mesonlib import MesonException

Loading…
Cancel
Save