scons: Make it so that the processing of trace flags does not depend on order
This commit is contained in:
parent
a01437ab03
commit
c76a8b1c15
1 changed files with 25 additions and 22 deletions
|
@ -209,13 +209,6 @@ def CompoundFlag(name, flags, desc=None):
|
||||||
raise AttributeError, "Flag %s already specified" % name
|
raise AttributeError, "Flag %s already specified" % name
|
||||||
|
|
||||||
compound = tuple(flags)
|
compound = tuple(flags)
|
||||||
for flag in compound:
|
|
||||||
if flag not in trace_flags:
|
|
||||||
raise AttributeError, "Trace flag %s not found" % flag
|
|
||||||
if trace_flags[flag][1]:
|
|
||||||
raise AttributeError, \
|
|
||||||
"Compound flag can't point to another compound flag"
|
|
||||||
|
|
||||||
trace_flags[name] = (name, compound, desc)
|
trace_flags[name] = (name, compound, desc)
|
||||||
|
|
||||||
Export('TraceFlag')
|
Export('TraceFlag')
|
||||||
|
@ -630,18 +623,34 @@ env.Command('python/swig/init.cc',
|
||||||
makeSwigInit)
|
makeSwigInit)
|
||||||
Source('python/swig/init.cc')
|
Source('python/swig/init.cc')
|
||||||
|
|
||||||
|
def getFlags(source_flags):
|
||||||
|
flagsMap = {}
|
||||||
|
flagsList = []
|
||||||
|
for s in source_flags:
|
||||||
|
val = eval(s.get_contents())
|
||||||
|
name, compound, desc = val
|
||||||
|
flagsList.append(val)
|
||||||
|
flagsMap[name] = bool(compound)
|
||||||
|
|
||||||
|
for name, compound, desc in flagsList:
|
||||||
|
for flag in compound:
|
||||||
|
if flag not in flagsMap:
|
||||||
|
raise AttributeError, "Trace flag %s not found" % flag
|
||||||
|
if flagsMap[flag]:
|
||||||
|
raise AttributeError, \
|
||||||
|
"Compound flag can't point to another compound flag"
|
||||||
|
|
||||||
|
flagsList.sort()
|
||||||
|
return flagsList
|
||||||
|
|
||||||
|
|
||||||
# Generate traceflags.py
|
# Generate traceflags.py
|
||||||
def traceFlagsPy(target, source, env):
|
def traceFlagsPy(target, source, env):
|
||||||
assert(len(target) == 1)
|
assert(len(target) == 1)
|
||||||
|
|
||||||
f = file(str(target[0]), 'w')
|
f = file(str(target[0]), 'w')
|
||||||
|
|
||||||
allFlags = []
|
allFlags = getFlags(source)
|
||||||
for s in source:
|
|
||||||
val = eval(s.get_contents())
|
|
||||||
allFlags.append(val)
|
|
||||||
|
|
||||||
allFlags.sort()
|
|
||||||
|
|
||||||
print >>f, 'basic = ['
|
print >>f, 'basic = ['
|
||||||
for flag, compound, desc in allFlags:
|
for flag, compound, desc in allFlags:
|
||||||
|
@ -683,10 +692,7 @@ def traceFlagsCC(target, source, env):
|
||||||
|
|
||||||
f = file(str(target[0]), 'w')
|
f = file(str(target[0]), 'w')
|
||||||
|
|
||||||
allFlags = []
|
allFlags = getFlags(source)
|
||||||
for s in source:
|
|
||||||
val = eval(s.get_contents())
|
|
||||||
allFlags.append(val)
|
|
||||||
|
|
||||||
# file header
|
# file header
|
||||||
print >>f, '''
|
print >>f, '''
|
||||||
|
@ -759,10 +765,7 @@ def traceFlagsHH(target, source, env):
|
||||||
|
|
||||||
f = file(str(target[0]), 'w')
|
f = file(str(target[0]), 'w')
|
||||||
|
|
||||||
allFlags = []
|
allFlags = getFlags(source)
|
||||||
for s in source:
|
|
||||||
val = eval(s.get_contents())
|
|
||||||
allFlags.append(val)
|
|
||||||
|
|
||||||
# file header boilerplate
|
# file header boilerplate
|
||||||
print >>f, '''
|
print >>f, '''
|
||||||
|
|
Loading…
Reference in a new issue