From 3335ff742493c44ec3bed96778441cc9561044f0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Mar 2010 19:49:42 +1100 Subject: build: added SUBST_VARS_RECURSIVE() --- buildtools/wafsamba/samba_utils.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'buildtools') diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index cb055043a7..7c0f4644ab 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -298,14 +298,23 @@ def mkdir_p(dir): os.mkdir(dir) +def SUBST_VARS_RECURSIVE(string, env): + '''recursively expand variables''' + if string is None: + return string + limit=100 + while (string.find('${') != -1 and limit > 0): + string = Utils.subst_vars(string, env) + limit -= 1 + return string + + def RUN_COMMAND(cmd, env=None, shell=False): '''run a external command, return exit code or signal''' - # recursively expand variables if env: - while cmd.find('${') != -1: - cmd = Utils.subst_vars(cmd, env) + cmd = SUBST_VARS_RECURSIVE(cmd, env) status = os.system(cmd) if os.WIFEXITED(status): -- cgit