mintro: Fix crash when required is a function (closes #5177)

pull/5197/head
Daniel Mensinger 6 years ago
parent 75219989ca
commit 1937bbafac
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 2
      mesonbuild/ast/introspection.py
  2. 8
      run_unittests.py
  3. 1
      test cases/unit/55 introspection/meson.build
  4. 1
      test cases/unit/55 introspection/meson_options.txt

@ -142,6 +142,8 @@ class IntrospectionInterpreter(AstInterpreter):
condition_level = node.condition_level if hasattr(node, 'condition_level') else 0
if isinstance(required, ElementaryNode):
required = required.value
if not isinstance(required, bool):
required = False
self.dependencies += [{
'name': name,
'required': required,

@ -3408,7 +3408,7 @@ recommended as it is not supported on some platforms''')
self.assertDictEqual(buildopts_to_find, {})
# Check buildsystem_files
bs_files = ['meson.build', 'sharedlib/meson.build', 'staticlib/meson.build']
bs_files = ['meson.build', 'meson_options.txt', 'sharedlib/meson.build', 'staticlib/meson.build']
bs_files = [os.path.join(testdir, x) for x in bs_files]
self.assertPathListEqual(list(sorted(res['buildsystem_files'])), list(sorted(bs_files)))
@ -3559,6 +3559,12 @@ recommended as it is not supported on some platforms''')
'has_fallback': False,
'conditional': False
},
{
'name': 'bugDep1',
'required': False,
'has_fallback': False,
'conditional': False
},
{
'name': 'somethingthatdoesnotexist',
'required': True,

@ -2,6 +2,7 @@ project('introspection', ['c', 'cpp'], version: '1.2.3', default_options: ['cpp_
dep1 = dependency('threads')
dep2 = dependency('zlib', required: false)
dep3 = dependency('bugDep1', required: get_option('test_opt1'))
if false
dependency('somethingthatdoesnotexist', required: true)

@ -0,0 +1 @@
option('test_opt1', type: 'boolean', value: false, description: 'simple boolean flag')
Loading…
Cancel
Save