Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Handle conditional targets:
condstr = evalConstExpr(e, e.props['cond'])
typ = mk.evalCondition(condstr)
# Condition never met, ignore the target:
if typ == '0':
utils.deadTargets.append(id)
return
# Condition always met:
elif typ == '1':
isCond = 0
elif typ != None:
raise ReaderError(e, "malformed condition: '%s'" % condstr)
if isCond:
checkConditionsSupport(e)
cond = mk.makeCondition(condstr)
if cond == None:
raise ReaderError(e, "malformed condition: '%s'" % condstr)
tags = rule.getTagsDict()
e = applyTemplates(e, rule.getTemplates() + extractTemplates(e, post=0),
extractTemplates(e, post=1))
if id in mk.targets:
raise ReaderError(e, "duplicate target name '%s'" % id)
if 'category' in e.props:
try:
cats = {
'all' : mk.Target.CATEG_ALL,
'normal' : mk.Target.CATEG_NORMAL,
'automatic' : mk.Target.CATEG_AUTOMATIC
else:
return None
else:
return None
ret = []
for e in all:
if all[e] is False:
pass
elif all[e] is True:
ret.append("%s=='%s'" % (e.name, values[e]))
else:
return None
if len(ret) == 0:
return '1'
else:
return mk.makeCondition(' and '.join(ret))
if '$' in v.value:
var.add(v.cond,
substitute2(v.value, callback, desc, cond2, hints))
else:
if len(v.value) == 0 or v.value.isspace():
var.add(v.cond, v.value)
else:
var.add(v.cond, callback(cond2, v.value))
return '$(%s)' % var.name
if expr in mk.options and mk.options[expr].values != None:
opt = mk.options[expr]
var = mk.CondVar(makeUniqueCondVarName('%s_%s' % (opt.name, desc)))
mk.addCondVar(var, hints)
for v in opt.values:
cond = mk.makeCondition("%s=='%s'" % (opt.name, v))
cond2 = mk.mergeConditions(cnd, cond)
if '$' in v:
var.add(cond, substitute2(v, callback, desc, cond2, hints))
else:
if len(v) == 0 or v.isspace(): var.add(cond, v)
else: var.add(cond, callback(cond2, v))
return '$(%s)' % var.name
if expr in __substituteCallbacks:
for func in __substituteCallbacks[expr]:
rval = func(expr, callback, caller)
if rval != None:
return rval
raise errors.Error("'%s' can't be used in this context, "%expr +
"not a conditional variable or option with listed values")
# Condition never met when generating this target:
if typ == '0':
if config.debug:
print "[dbg] removing never-met condition '%s' for variable '%s'" % (condstr, name)
continue
# Condition always met:
elif typ == '1':
if config.debug:
print "[dbg] condition '%s' for variable '%s' is always met" % (condstr, name)
noValueSet = 0
isCond = 0
value = e_if.value
break
elif typ != None:
raise ReaderError(e, "malformed condition '%s': doesn't evaluate to boolean value" % condstr)
cond = mk.makeCondition(condstr)
noValueSet = 0
# Real conditions:
checkConditionsSupport(e)
if 'scope' in e.props:
raise ReaderError(e, "conditional variable can't have nondefault scope ('%s')" % e.props['scope'])
if target != None:
if (not overwrite) and (name in target.vars):
return
name = '__%s_%s' % (target.id.replace('-','_').replace('.','_').replace('/','_'),
basename)
mk.setVar(e.props['var'], '$(%s)' % name,