def make_substitutions(conf):
 r = re.compile(CONF_VARIABLE_REGEX)
 def sub(s, depth=0):
  if (depth > 100):
   logging.warn(('Max recursion depth exceeded when substituting jobconf value: %s' % s))
   return s
  m = r.search(s)
  if m:
   for g in [g for g in m.groups() if (g in conf)]:
    substr = ('${%s}' % g)
    s = s.replace(substr, sub(conf[g], (depth + 1)))
  return s
 for (k, v) in conf.items():
  conf[k] = sub(v)
 return conf

def make_substitutions ( conf ) : r = re . compile ( CONF_VARIABLE_REGEX ) def sub ( s , depth = 0 ) : if ( depth > 100 ) : logging . warn ( ( 'Max recursion depth exceeded when substituting jobconf value: %s' % s ) ) return s m = r . search ( s ) if m : for g in [ g for g in m . groups ( ) if ( g in conf ) ] : substr = ( '${%s}' % g ) s = s . replace ( substr , sub ( conf [ g ] , ( depth + 1 ) ) ) return s for ( k , v ) in conf . items ( ) : conf [ k ] = sub ( v ) return conf
substitute occurences of ${foo} with conf[foo] .