aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRihards Skuja <rihardssk@mikrotik.com>2021-08-27 12:36:50 +0300
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-08-27 19:51:48 +0200
commit4523e9d288d3a97e54d1e971ab9c022616b710e2 (patch)
treeaa872b32ed65c7a9dcf92b6611e05399b3829933
parent16a162d10af8d4d73dbf0b078f192fcf5de22e0e (diff)
downloadmeson-4523e9d288d3a97e54d1e971ab9c022616b710e2.zip
meson-4523e9d288d3a97e54d1e971ab9c022616b710e2.tar.gz
meson-4523e9d288d3a97e54d1e971ab9c022616b710e2.tar.bz2
interpreter: fix IndexError when specifying dependency 'include_type'
Exception is thrown when dependency name is empty and when its 'include_type' differs from the default one. Regression from b6d754a40c.
-rw-r--r--mesonbuild/interpreter/interpreter.py2
-rw-r--r--test cases/common/219 include_type dependency/meson.build3
2 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 35529a3..c716c85 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -1481,7 +1481,7 @@ external dependencies (including libraries) must go to "dependencies".''')
raise InvalidArguments('The `include_type` kwarg must be a string')
actual = d.get_include_type()
if wanted != actual:
- mlog.debug(f'Current include type of {names[0]} is {actual}. Converting to requested {wanted}')
+ mlog.debug(f'Current include type of {args[0]} is {actual}. Converting to requested {wanted}')
d = d.generate_system_dependency(wanted)
return d
diff --git a/test cases/common/219 include_type dependency/meson.build b/test cases/common/219 include_type dependency/meson.build
index fe21dbb..678fb4e 100644
--- a/test cases/common/219 include_type dependency/meson.build
+++ b/test cases/common/219 include_type dependency/meson.build
@@ -36,6 +36,9 @@ assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the origi
fallback = dependency('sdffgagf_does_not_exist', include_type: 'system', fallback: ['subDep', 'subDep_dep'])
assert(fallback.include_type() == 'system', 'include_type works with dependency fallback')
+fallback_empty = dependency('', include_type: 'system', fallback: ['subDep', 'subDep_dep'])
+assert(fallback_empty.include_type() == 'system', 'include_type works with empty name dependency fallback')
+
# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167
main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep)
test('main_test', main_exe)