diff options
author | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-05-17 14:47:35 +0100 |
---|---|---|
committer | Benjamin Schubert <ben.c.schubert@gmail.com> | 2019-05-22 18:40:03 +0100 |
commit | 7c6b6a10c596c77ccdc0d7a44cb485ab1ad52ba9 (patch) | |
tree | 859ab5f5f05998e9f539eac2d623cfddb918b28e | |
parent | 54f3ff69c5313bde9898c2492517e138bcd7450a (diff) | |
download | buildstream-7c6b6a10c596c77ccdc0d7a44cb485ab1ad52ba9.tar.gz |
WIP: cythonize _expand_expstr
-rw-r--r-- | src/buildstream/_variables.pyx | 8 |
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) |