summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-01 19:43:33 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-01 20:21:48 -0400
commit55ba299423e2f5ab24438c771fb11d66868ad979 (patch)
tree9cfde25e2a72884c1e7d9deb31a64c272c326d34
parent328dddf0f958508aa8bec4db87b4349041662e94 (diff)
downloadbuildstream-55ba299423e2f5ab24438c771fb11d66868ad979.tar.gz
_frontend/main.py: Fix stack track when project has no element-path
project.conf is not required to specify any element-path, and our shallow parse is not as smart as instantiating a Project() instance which we would rather avoid when doing completions.
-rw-r--r--buildstream/_frontend/main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 566a98a2a..e2b2f8c2a 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -74,12 +74,17 @@ def complete_target(ctx, args, incomplete):
element_directory = None
try:
project = _yaml.load(project_file)
- element_directory = project['element-path']
except LoadError:
# If there is no project directory in context, just dont
# even bother trying to complete anything.
return []
+ # The project is not required to have an element-path
+ try:
+ element_directory = project['element-path']
+ except KeyError:
+ pass
+
# If a project was loaded, use it's element-path to
# adjust our completion's base directory
if element_directory: