diff options
author | Tom Pollard <tom.pollard@codethink.co.uk> | 2018-08-17 15:54:43 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-08-31 15:26:44 +0900 |
commit | 127893fa105965c40a70f7a5dbaf9974ebd4004d (patch) | |
tree | a5a261ddacd2baefc550dd304a65656d27b89621 /buildstream | |
parent | b83f7fa1c33f864288685d93f054c2966c94709a (diff) | |
download | buildstream-127893fa105965c40a70f7a5dbaf9974ebd4004d.tar.gz |
buildstream/_project.py: Report if project.conf is missing name
Explicitly check that project.conf contains a name. This resolves
the issue of the provenance check from _yaml.py incorrectly reporting
the offending file as the default_config_node projectconfig.yaml
when no name key exists in the pre_config_node dict.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_project.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/buildstream/_project.py b/buildstream/_project.py index 873f3387e..6cd65bb64 100644 --- a/buildstream/_project.py +++ b/buildstream/_project.py @@ -395,6 +395,11 @@ class Project(): "Project requested format version {}, but BuildStream {}.{} only supports up until format version {}" .format(format_version, major, minor, BST_FORMAT_VERSION)) + # Check if project.conf contains name key field + if self._project_conf.get('name') is None: + raise LoadError(LoadErrorReason.INVALID_DATA, + "{}: project.conf does not contain expected key '{}'".format(projectfile, 'name')) + # The project name, element path and option declarations # are constant and cannot be overridden by option conditional statements self.name = _yaml.node_get(pre_config_node, str, 'name') |