Unhandled NoneType exception
Summary
If you have an element with "depends:" but nothing in the depends, it gives a nonetype error
Steps to reproduce
make a normal element and add a "depends:" line to it, but no dependency beneath it
kind: stack
description: |
Main stack target for the bst build test
depends:
Attempt to build this project and you will get an exception
What is the current bug behavior?
A NoneType exception is thrown
What is the expected correct behavior?
I would expect an invalid YAML error
Relevant logs and/or screenshots
Traceback (most recent call last):
File "/home/phillipsmyth/.local/bin/bst", line 8, in <module>
sys.exit(cli())
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/phillipsmyth/projects/buildstream/buildstream/_frontend/cli.py", line 166, in override_main
standalone_mode=standalone_mode, **extra)
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/home/phillipsmyth/projects/buildstream/buildstream/_frontend/cli.py", line 336, in build
build_all=all_)
File "/home/phillipsmyth/projects/buildstream/buildstream/_stream.py", line 182, in build
dynamic_plan=True)
File "/home/phillipsmyth/projects/buildstream/buildstream/_stream.py", line 952, in _load
fetch_subprojects=fetch_subprojects)
File "/home/phillipsmyth/projects/buildstream/buildstream/_pipeline.py", line 111, in load
fetch_subprojects=fetch_subprojects)
File "/home/phillipsmyth/projects/buildstream/buildstream/_project.py", line 334, in load_elements
fetch_subprojects=fetch_subprojects)
File "/home/phillipsmyth/projects/buildstream/buildstream/_loader/loader.py", line 134, in load
loader._load_file(name, rewritable, ticker, fetch_subprojects, yaml_cache)
File "/home/phillipsmyth/projects/buildstream/buildstream/_loader/loader.py", line 278, in _load_file
element = LoadElement(node, filename, self)
File "/home/phillipsmyth/projects/buildstream/buildstream/_loader/loadelement.py", line 78, in __init__
self.deps = _extract_depends_from_node(self.node)
File "/home/phillipsmyth/projects/buildstream/buildstream/_loader/loadelement.py", line 135, in
_extract_depends_from_node
depends = _extract_depends_from_node(node, key=Symbol.DEPENDS)
File "/home/phillipsmyth/projects/buildstream/buildstream/_loader/loadelement.py", line 149, in _extract_depends_from_node
for index, dep in enumerate(depends):
TypeError: 'NoneType' object is not iterable
Possible fixes
Other relevant information
- BuildStream version affected: /milestone %BuildStream_v1.x