diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/_element.pyx | 23 |
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 |