summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-10-21 13:23:36 -0700
committerDylan Baker <dylan@pnwbakers.com>2025-12-17 10:27:54 -0800
commit52974210d5225825bf13a997941120b6c224bd9f (patch)
treea2e410f364bd4eca1c5eaea56f7cfd6220a4212d
parent2488f3f4b2f192a11d62534a08e792fd36f800c0 (diff)
downloadmeson-52974210d5225825bf13a997941120b6c224bd9f.tar.gz
backend: improve error message about install_dir install_count mismatch
Among other things it will say "expects X but only has Y", even if Y > X.
-rw-r--r--mesonbuild/backend/backends.py4
-rw-r--r--test cases/failing/40 custom target outputs not matching install_dirs/test.json3
2 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 9271af586..21f90661f 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1690,10 +1690,10 @@ class Backend:
# Sanity-check the outputs and install_dirs
num_outdirs, num_out = len(outdirs), len(t.get_outputs())
if num_outdirs not in {1, num_out}:
- m = 'Target {!r} has {} outputs: {!r}, but only {} "install_dir"s were found.\n' \
+ m = 'Target {!r} has {} outputs: {!r}, but {} "install_dir"s were found: {!r}.\n' \
"Pass 'false' for outputs that should not be installed and 'true' for\n" \
'using the default installation directory for an output.'
- raise MesonException(m.format(t.name, num_out, t.get_outputs(), num_outdirs))
+ raise MesonException(m.format(t.name, num_out, t.get_outputs(), num_outdirs, outdirs))
assert len(t.install_tag) == num_out
install_mode = t.get_custom_install_mode()
# because mypy gets confused type narrowing in lists
diff --git a/test cases/failing/40 custom target outputs not matching install_dirs/test.json b/test cases/failing/40 custom target outputs not matching install_dirs/test.json
index f9e2ba781..e6ea59770 100644
--- a/test cases/failing/40 custom target outputs not matching install_dirs/test.json
+++ b/test cases/failing/40 custom target outputs not matching install_dirs/test.json
@@ -27,7 +27,8 @@
],
"stdout": [
{
- "line": "ERROR: Target 'too-few-install-dirs' has 3 outputs: ['toofew.h', 'toofew.c', 'toofew.sh'], but only 2 \"install_dir\"s were found."
+ "line": "ERROR: Target 'too-few-install-dirs' has 3 outputs: \\['toofew.h', 'toofew.c', 'toofew.sh'\\], but 2 \"install_dir\"s were found: \\['([a-zA-Z]:)?/usr/include', False\\]\\.",
+ "match": "re"
}
]
}