summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-26 14:36:29 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-26 14:47:17 +0900
commitb5c59295786d4989470e7a4fa0988f592716593e (patch)
tree25066e82251f3ec7bfa10c40b9fa8cae5b7517f6
parent16e719a93fc6e4bdbb1725157024366c41917edb (diff)
downloadbuildstream-b5c59295786d4989470e7a4fa0988f592716593e.tar.gz
element.py: Added BST_FORBID_BDEPENDS to compliment BST_FORBID_RDEPENDS
-rw-r--r--buildstream/element.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index e33f7ba21..917a9e762 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -175,7 +175,13 @@ class Element(Plugin):
"""
BST_FORBID_RDEPENDS = False
- """Whether to raise exceptions if an element has runtime-dependencies.
+ """Whether to raise exceptions if an element has runtime dependencies.
+
+ *Since: 1.2*
+ """
+
+ BST_FORBID_BDEPENDS = False
+ """Whether to raise exceptions if an element has build dependencies.
*Since: 1.2*
"""
@@ -1146,11 +1152,22 @@ class Element(Plugin):
# the element and it's sources.
#
def _preflight(self):
+
+ if self.BST_FORBID_RDEPENDS and self.BST_FORBID_BDEPENDS:
+ if any(self.dependencies(Scope.RUN, recurse=False)) or any(self.dependencies(Scope.RUN, recurse=False)):
+ raise ElementError("{}: Dependencies are forbidden for '{}' elements"
+ .format(self, self.get_kind()), reason="element-forbidden-depends")
+
if self.BST_FORBID_RDEPENDS:
if any(self.dependencies(Scope.RUN, recurse=False)):
raise ElementError("{}: Runtime dependencies are forbidden for '{}' elements"
.format(self, self.get_kind()), reason="element-forbidden-rdepends")
+ if self.BST_FORBID_BDEPENDS:
+ if any(self.dependencies(Scope.BUILD, recurse=False)):
+ raise ElementError("{}: Build dependencies are forbidden for '{}' elements"
+ .format(self, self.get_kind()), reason="element-forbidden-bdepends")
+
if self.BST_FORBID_SOURCES:
if any(self.sources()):
raise ElementError("{}: Sources are forbidden for '{}' elements"