changeset 507:1c4fbefeda3a

Handle `with` being a reserved word in Python 2.5 - fixes #217 (patch by mgood)
author dfraser
date Tue, 10 Mar 2009 10:03:29 +0000
parents be811cb659b7
children 90302c84571e
files bitten/build/ctools.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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]))
Copyright (C) 2012-2017 Edgewall Software