diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-02-16 22:52:52 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-02-16 22:59:48 -0500 |
commit | aa0450adda03e40874deb5085260ee28f3f46e3b (patch) | |
tree | d620193e3ee73c6491139b44584a96faa9a543ed /mesonbuild | |
parent | 996d471f5f04202cc1d72b3f96530df835936a6f (diff) | |
download | meson-aa0450adda03e40874deb5085260ee28f3f46e3b.zip meson-aa0450adda03e40874deb5085260ee28f3f46e3b.tar.gz meson-aa0450adda03e40874deb5085260ee28f3f46e3b.tar.bz2 |
fix a couple misuses of textwrap.dedent
A backslash-escape of the last newline before a run of whitespace
leading to the indented string ending and function termination `)` does
not actually escape the entire line and make it do nothing. In fact what
it does is cause all that whitespace to be part of the preceding line,
and get printed.
Meanwhile the textwrap.dedent documentation states that lines with only
whitespace get normalized. When you *don't* mess with that final line,
dedent actually does the right thing and makes the output message end
with a single newline after the important text.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/build.py | 6 | ||||
-rw-r--r-- | mesonbuild/mparser.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index cdd761f..0ffb629 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -525,7 +525,7 @@ class Target(HoldableObject): mlog.warning(textwrap.dedent(f'''\ Target "{self.name}" has a path separator in its name. This is not supported, it can cause unexpected failures and will become - a hard error in the future.\ + a hard error in the future. ''')) self.install = False self.build_always_stale = False @@ -1059,7 +1059,7 @@ class BuildTarget(Target): is reserved for libraries built as part of this project. External libraries must be passed using the dependencies keyword argument instead, because they are conceptually "external dependencies", - just like those detected with the dependency() function.\ + just like those detected with the dependency() function. ''')) self.link(linktarget) lwhole = extract_as_list(kwargs, 'link_whole') @@ -1112,7 +1112,7 @@ class BuildTarget(Target): mlog.warning(textwrap.dedent('''\ Please do not define rpath with a linker argument, use install_rpath or build_rpath properties instead. - This will become a hard error in a future Meson release.\ + This will become a hard error in a future Meson release. ''')) self.process_link_depends(kwargs.get('link_depends', []), environment) # Target-specific include dirs must be added BEFORE include dirs from diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index 735766e..85b649a 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -196,7 +196,7 @@ class Lexer: if match_text.find("\n") != -1: mlog.warning(textwrap.dedent("""\ Newline character in a string detected, use ''' (three single quotes) for multiline strings instead. - This will become a hard error in a future Meson release.\ + This will become a hard error in a future Meson release. """), self.getline(line_start), str(lineno), |