summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-17 14:47:35 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-22 18:40:03 +0100
commit7c6b6a10c596c77ccdc0d7a44cb485ab1ad52ba9 (patch)
tree859ab5f5f05998e9f539eac2d623cfddb918b28e
parent54f3ff69c5313bde9898c2492517e138bcd7450a (diff)
downloadbuildstream-7c6b6a10c596c77ccdc0d7a44cb485ab1ad52ba9.tar.gz
WIP: cythonize _expand_expstr
-rw-r--r--src/buildstream/_variables.pyx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx
index 3dc5c5d04..2409cd69a 100644
--- a/src/buildstream/_variables.pyx
+++ b/src/buildstream/_variables.pyx
@@ -242,15 +242,15 @@ cdef void _internal_expand(dict content, list value, list acc, int counter = 0)
# of the given dictionary of expansion strings.
#
# Note: Will raise KeyError if any expansion is missing
-def _expand_expstr(content, topvalue):
+cdef str _expand_expstr(dict content, list topvalue):
# Short-circuit constant strings
if len(topvalue) == 1:
- return topvalue[0]
+ return <str> topvalue[0]
# Short-circuit strings which are entirely an expansion of another variable
# e.g. "%{another}"
- if len(topvalue) == 2 and topvalue[0] == "":
- return _expand_expstr(content, content[topvalue[1]])
+ if len(topvalue) == 2 and len(<str> topvalue[0]) == 0:
+ return _expand_expstr(content, <list> content[topvalue[1]])
cdef list result = []
_internal_expand(content, topvalue, result)