summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildtools/wafsamba/samba_utils.py15
1 files changed, 12 insertions, 3 deletions
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):