summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-06-03 20:35:36 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-06-03 20:35:36 +0100
commit06dcaa825b87254552b2783b881981d010b08e5b (patch)
tree3684134a8dd4b0d70a4e02b6a2dc682afd1302d3 /src
parentc11446e033412276815a96500436f559b596ba6f (diff)
downloadbuildstream-06dcaa825b87254552b2783b881981d010b08e5b.tar.gz
WIP: use internal version of scope
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/_element.pyx23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/buildstream/_element.pyx b/src/buildstream/_element.pyx
index 330b45086..de1182357 100644
--- a/src/buildstream/_element.pyx
+++ b/src/buildstream/_element.pyx
@@ -22,12 +22,18 @@ from itertools import chain
from .types import Scope
+cdef enum CScope:
+ ALL
+ BUILD
+ NONE
+ RUN
+
# visit()
#
# Visit an element dependencies and return them according to the scope.
#
# FIXME: visited should be BitMap once PyRoaring exports its symbols
-cdef visit(object element, object scope, object visited, list acc):
+cdef visit(object element, CScope scope, object visited, list acc):
if scope == Scope.ALL:
visited[0].add(element._unique_id)
visited[1].add(element._unique_id)
@@ -58,5 +64,16 @@ cdef visit(object element, object scope, object visited, list acc):
def visit_dependencies(element, scope, visited):
cdef list acc = []
- visit(element, scope, visited, acc)
- return acc \ No newline at end of file
+ cdef CScope c_scope
+
+ if scope == Scope.ALL:
+ c_scope = CScope.ALL
+ elif scope == Scope.BUILD:
+ c_scope = CScope.BUILD
+ elif c_scope == Scope.RUN:
+ c_scope = CScope.RUN
+ else:
+ c_scope = CScope.NONE
+
+ visit(element, c_scope, visited, acc)
+ return acc