aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-02-12 18:47:51 +0000
committerJon Turney <jon.turney@dronecode.org.uk>2020-04-30 20:11:32 +0100
commit6a5c6fb439c9351d513c63ff7eb028dde4c3f1c0 (patch)
tree0495f3e74405d402fa3fbad32173b1f9699841b2 /mesonbuild/interpreter.py
parentd1920886a1e3f0e50969399a836a76ecf01d703e (diff)
downloadmeson-6a5c6fb439c9351d513c63ff7eb028dde4c3f1c0.zip
meson-6a5c6fb439c9351d513c63ff7eb028dde4c3f1c0.tar.gz
meson-6a5c6fb439c9351d513c63ff7eb028dde4c3f1c0.tar.bz2
Be more careful about the use of repr() in error messages
Generally, we'd want to use str() rather than repr() in error messages anyhow, as that explicitly gives something designed to be read by humans. Sometimes {!r} is being used as a shortcut to avoid writing the quotes in '{!s}'. Unfortunately, these things aren't quite the same, as the repr of a string containing '\' (the path separator on Windows) will have those escaped. We don't have a good string representation to use for the arbitrary internal object used as an argument for install_data() when it's neither a string nor file (which doesn't lead to a good error message), so drop that for the moment.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index dd1e57b..11eceae 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3897,7 +3897,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
absname = os.path.join(self.environment.get_source_dir(), buildfilename)
if not os.path.isfile(absname):
self.subdir = prev_subdir
- raise InterpreterException('Non-existent build file {!r}'.format(buildfilename))
+ raise InterpreterException("Non-existent build file '{!s}'".format(buildfilename))
with open(absname, encoding='utf8') as f:
code = f.read()
assert(isinstance(code, str))
@@ -3945,7 +3945,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
elif isinstance(s, str):
source_strings.append(s)
else:
- raise InvalidArguments('Argument {!r} must be string or file.'.format(s))
+ raise InvalidArguments('Argument must be string or file.')
sources += self.source_strings_to_files(source_strings)
install_dir = kwargs.get('install_dir', None)
if not isinstance(install_dir, (str, type(None))):