class CompilerSpec:
"""Describes a compiler/make setup.
Used to define different situations such as local compilation, and
various degrees of parallelism."""
def __init__(self, cc=None, make_opts=None, name=None):
self.cc = cc or 'gcc'
self.make_opts = make_opts or ''
self.name = name or (self.cc + "__" + self.make_opts).replace(' ', '_')
def default_compilers():
return [CompilerSpec('gcc', ''),
CompilerSpec('distcc gcc', '-j8'),
]
def parse_opt(optarg):
"""Parse command-line specification of a compiler
XXX: I don't really know what the best syntax for this is. For
the moment, it is "local" or "dist", followed by a comma and a
-j number. Perhaps we need to be able to specify host lists here
too.
"""
where, howmany = optarg.split(',')
howmany = int(howmany)
if where == 'local':
return CompilerSpec(cc='gcc', make_opts='-j%d' % howmany)
elif where == 'dist':
return CompilerSpec(cc='distcc gcc-3.2', make_opts='-j%d' % howmany)
else:
raise ValueError, ("don't understand %s" % `where`)