diff options
author | James Ennis <james.ennis@codethink.com> | 2018-06-28 18:34:47 +0100 |
---|---|---|
committer | James Ennis <james.ennis@codethink.com> | 2018-06-29 09:45:12 +0100 |
commit | 48848f4e69201b78524443dc34a77cf872e0ad6c (patch) | |
tree | eb6dcfb50fd27289003131750d20524908ab69f7 /buildstream/_loader | |
parent | 463698ec3203190aeac1f41ed3885f08e95bceae (diff) | |
download | buildstream-48848f4e69201b78524443dc34a77cf872e0ad6c.tar.gz |
loader.py: Check whether the dir specified is also a <dir>.bst file
- Slight modification to the wording of existing error message.
- Closes #446
Diffstat (limited to 'buildstream/_loader')
-rw-r--r-- | buildstream/_loader/loader.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/buildstream/_loader/loader.py b/buildstream/_loader/loader.py index 42e7feef5..07b0de996 100644 --- a/buildstream/_loader/loader.py +++ b/buildstream/_loader/loader.py @@ -229,6 +229,16 @@ class Loader(): detail = "Did you mean '{}'?".format(element_relpath) raise LoadError(LoadErrorReason.MISSING_FILE, message, detail=detail) from e + elif e.reason == LoadErrorReason.LOADING_DIRECTORY: + # If a <directory>.bst file exists in the element path, + # let's suggest this as a plausible alternative. + message = str(e) + detail = None + if os.path.exists(os.path.join(self._basedir, filename + '.bst')): + element_name = filename + '.bst' + detail = "Did you mean '{}'?\n".format(element_name) + raise LoadError(LoadErrorReason.LOADING_DIRECTORY, + message, detail=detail) from e else: raise self._options.process_node(node) |