summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-19 19:49:42 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:54 +1000
commit3335ff742493c44ec3bed96778441cc9561044f0 (patch)
tree666f864f670c1a4f1804b61ccc861fa997db936e /buildtools
parent550b985235351f792327d30a34ac9608e397100e (diff)
downloadsamba-3335ff742493c44ec3bed96778441cc9561044f0.tar.gz
samba-3335ff742493c44ec3bed96778441cc9561044f0.tar.bz2
samba-3335ff742493c44ec3bed96778441cc9561044f0.zip
build: added SUBST_VARS_RECURSIVE()
Diffstat (limited to 'buildtools')
-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):