# HG changeset patch # User dfraser # Date 1236679409 0 # Node ID 1c4fbefeda3a815ff61ae355f32fac4f4351067b # Parent be811cb659b70ee8db5ec2d0d2ed0252fe081bac Handle `with` being a reserved word in Python 2.5 - fixes #217 (patch by mgood) diff --git a/bitten/build/ctools.py b/bitten/build/ctools.py --- a/bitten/build/ctools.py +++ b/bitten/build/ctools.py @@ -23,8 +23,8 @@ __docformat__ = 'restructuredtext en' -def configure(ctxt, file_='configure', enable=None, disable=None, with=None, - without=None, cflags=None, cxxflags=None): +def configure(ctxt, file_='configure', enable=None, disable=None, with_=None, + without=None, cflags=None, cxxflags=None, **kw): """Run a ``configure`` script. :param ctxt: the build context @@ -32,7 +32,7 @@ :param file\_: name of the configure script :param enable: names of the features to enable, seperated by spaces :param disable: names of the features to disable, separated by spaces - :param with: names of external packages to include + :param with_: names of external packages to include :param without: names of external packages to exclude :param cflags: ``CFLAGS`` to pass to the configure script :param cxxflags: ``CXXFLAGS`` to pass to the configure script @@ -42,8 +42,12 @@ 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(): + # since 'with' is a reserved word in python, we need to handle the argument carefully + with_ = kw.pop('with', with_) + for key in kw: + raise TypeError("configure() got an unexpected keyword argument '%s'" % key) + 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]))