Mercurial > bitten > bitten-test
changeset 238:832e64330c31
Add a `<c:configure>` recipe command for running configure scripts. Closes #57.
author | cmlenz |
---|---|
date | Sat, 01 Oct 2005 22:17:46 +0000 |
parents | fd509f1ea029 |
children | bc7b77236011 |
files | bitten/build/ctools.py bitten/recipe.py setup.py |
diffstat | 3 files changed, 39 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bitten/build/ctools.py +++ b/bitten/build/ctools.py @@ -14,6 +14,42 @@ log = logging.getLogger('bitten.build.ctools') +def configure(ctxt, file_='configure', enable=None, disable=None, with=None, + without=None, cflags=None, cxxflags=None): + """Run a configure script.""" + args = [] + if enable: + args += ['--enable-%s' % feature for feature in enable.split()] + if disable: + args += ['--disable-%s' % feature for feature in disable.split()] + if with: + for pkg in with.split(): + pkg_path = pkg + '.path' + if pkg_path in ctxt.config: + args.append('--with-%s=%s' % (pkg, ctxt.config[pkg_path])) + else: + args.append('--with-%s' % pkg) + if without: + args += ['--without-%s' % pkg for pkg in without.split()] + if cflags: + args.append('CFLAGS="%s"' % cflags) + if cxxflags: + args.append('CXXFLAGS="%s"' % cflags) + + log_elem = xmlio.Fragment() + cmdline = CommandLine(ctxt.resolve(file_), args) + for out, err in cmdline.execute(): + if out is not None: + log.info(out) + log_elem.append(xmlio.Element('message', level='info')[out]) + if err is not None: + log.error(err) + log_elem.append(xmlio.Element('message', level='error')[err]) + ctxt.log(log_elem) + + if cmdline.returncode != 0: + ctxt.error('configure failed (%s)' % cmdline.returncode) + def make(ctxt, target=None, file_=None, keep_going=False): """Execute a Makefile target.""" args = ['--directory', ctxt.basedir]
--- a/bitten/recipe.py +++ b/bitten/recipe.py @@ -14,6 +14,7 @@ from pkg_resources import WorkingSet from bitten.build import BuildError +from bitten.build.config import Configuration from bitten.util import xmlio __all__ = ['Recipe'] @@ -33,7 +34,7 @@ def __init__(self, basedir, config=None): self.basedir = os.path.realpath(basedir) - self.config = config or {} + self.config = config or Configuration() self.output = [] def run(self, step, namespace, name, attr):
--- a/setup.py +++ b/setup.py @@ -44,6 +44,7 @@ 'bitten.recipe_commands': [ NS + 'sh#exec = bitten.build.shtools:exec_', NS + 'sh#pipe = bitten.build.shtools:pipe', + NS + 'c#configure = bitten.build.ctools:configure', NS + 'c#make = bitten.build.ctools:make', NS + 'python#distutils = bitten.build.pythontools:distutils', NS + 'python#exec = bitten.build.pythontools:exec_',