diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-08-31 16:01:50 +0300 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-08-31 16:01:50 +0300 |
commit | ce4fe960180d1719b691d6e1895d240c5ab2087c (patch) | |
tree | 972e1f80b60414ec790e22d56655d72f2a35d995 | |
parent | 5044fd257046073fc6f1c43029c71bef07b8cbe7 (diff) | |
download | buildstream-ce4fe960180d1719b691d6e1895d240c5ab2087c.tar.gz |
_loader/types.pyx: Disallow explicitly setting 'strict' to False
This is in order to keep the door open to allowing the project.conf
set the default of dependency 'strict'-ness which might be useful
for projects which use mostly static linking and the like, in which
case we can later interpret explicitly non-strict dependencies
as an override of the project default.
-rw-r--r-- | buildstream/_loader/types.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/buildstream/_loader/types.py b/buildstream/_loader/types.py index 5b4d0121e..a49ff380b 100644 --- a/buildstream/_loader/types.py +++ b/buildstream/_loader/types.py @@ -93,6 +93,20 @@ class Dependency(): self.junction = _yaml.node_get(dep, str, Symbol.JUNCTION, default_value=None) self.strict = _yaml.node_get(dep, bool, Symbol.STRICT, default_value=False) + # Here we disallow explicitly setting 'strict' to False. + # + # This is in order to keep the door open to allowing the project.conf + # set the default of dependency 'strict'-ness which might be useful + # for projects which use mostly static linking and the like, in which + # case we can later interpret explicitly non-strict dependencies + # as an override of the project default. + # + if self.strict == False and Symbol.STRICT in dep: + provenance = _yaml.node_get_provenance(dep, key=Symbol.STRICT) + raise LoadError(LoadErrorReason.INVALID_DATA, + "{}: Setting 'strict' to False is unsupported" + .format(provenance)) + else: raise LoadError(LoadErrorReason.INVALID_DATA, "{}: Dependency is not specified as a string or a dictionary".format(provenance)) |