summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-08-31 14:54:33 +0300
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-08-31 15:05:52 +0300
commit97c520fdcf75a4b11ea3df22f88cbc564c1c6357 (patch)
tree4608133412a384cccfe47d81b196d1f7fe31d7a2
parent4d36ca3a3407a29afff2006167dd83f788759ec0 (diff)
downloadbuildstream-97c520fdcf75a4b11ea3df22f88cbc564c1c6357.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--src/buildstream/_loader/types.pyx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/buildstream/_loader/types.pyx b/src/buildstream/_loader/types.pyx
index cd1302b45..42a7b801f 100644
--- a/src/buildstream/_loader/types.pyx
+++ b/src/buildstream/_loader/types.pyx
@@ -100,6 +100,19 @@ cdef class Dependency:
self.junction = (<MappingNode> dep).get_str(<str> Symbol.JUNCTION, None)
self.strict = (<MappingNode> dep).get_bool(<str> Symbol.STRICT, 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 = dep.get_scalar(Symbol.STRICT).get_provenance()
+ raise LoadError("{}: Setting 'strict' to False is unsupported"
+ .format(provenance), LoadErrorReason.INVALID_DATA)
+
else:
raise LoadError("{}: Dependency is not specified as a string or a dictionary".format(self.provenance),
LoadErrorReason.INVALID_DATA)