summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-17 14:47:35 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-05-29 19:47:57 +0100
commit738e7e68087f34421eea7478cc2743c962dd4ae5 (patch)
tree5fb197d095f596b94993355821c9d4c4c043f8ad
parent41293b1badeb12689ea72cd42c2d68df492c4274 (diff)
downloadbuildstream-738e7e68087f34421eea7478cc2743c962dd4ae5.tar.gz
_variables: 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 405171b61..ccf1a0b2c 100644
--- a/src/buildstream/_variables.pyx
+++ b/src/buildstream/_variables.pyx
@@ -255,15 +255,15 @@ cdef void _expand_expstr_helper(dict content, list value, list acc, int counter
# 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 = []
_expand_expstr_helper(content, topvalue, result)