Edgewall Software
Modify

Opened 8 years ago

Closed 6 years ago

Last modified 4 years ago

#217 closed defect (fixed)

replace with -> with_ in build/ctools (a reserved word in Python 2.6)

Reported by: davidf@… Owned by: dfraser
Priority: minor Milestone: 0.6
Component: General Version: dev
Keywords: Cc: thomas.moschny@…
Operating System: Linux

Description

In bitten/build/ctools.py, with is used as an argument to the configure method. This generates warnings on Python 2.5:

bitten/build/ctools.py:26: Warning: 'with' will become a reserved keyword in Python 2.6
bitten/build/ctools.py:45: Warning: 'with' will become a reserved keyword in Python 2.6
bitten/build/ctools.py:48: Warning: 'with' will become a reserved keyword in Python 2.6

It would be best to replace this sooner than later to prevent people writing scripts which wil have to change.

Attachments (1)

replace-with-argument.patch (1.7 KB) - added by davidf@… 8 years ago.
Patch that adds a with_ argument to configure, and warns of the deprecation of the with argument

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by davidf@…

Patch that adds a with_ argument to configure, and warns of the deprecation of the with argument

comment:1 Changed 8 years ago by mgood

We shouldn't require users to change anything in their build recipes. This patch eliminates using "with" as a parameter name and should provide both backwards and forwards compatibility. I'll try to write up some unit tests for this, but I think this should work:

  • bitten/build/ctools.py

     
    2222
    2323__docformat__ = 'restructuredtext en'
    2424
    25 def configure(ctxt, file_='configure', enable=None, disable=None, with=None,
    26               without=None, cflags=None, cxxflags=None):
     25def configure(ctxt, file_='configure', enable=None, disable=None, with_=None,
     26              without=None, cflags=None, cxxflags=None, **kw):
    2727    """Run a ``configure`` script.
    2828   
    2929    :param ctxt: the build context
     
    3131    :param file\_: name of the configure script
    3232    :param enable: names of the features to enable, seperated by spaces
    3333    :param disable: names of the features to disable, separated by spaces
    34     :param with: names of external packages to include
     34    :param with_: names of external packages to include
    3535    :param without: names of external packages to exclude
    3636    :param cflags: ``CFLAGS`` to pass to the configure script
    3737    :param cxxflags: ``CXXFLAGS`` to pass to the configure script
     
    4141        args += ['--enable-%s' % feature for feature in enable.split()]
    4242    if disable:
    4343        args += ['--disable-%s' % feature for feature in disable.split()]
    44     if with:
    45         for pkg in with.split():
     44    with_ = kw.pop('with', with_)
     45    for key in kw:
     46        raise TypeError("configure() got an unexpected keyword argument '%s'" % key)
     47    if with_:
     48        for pkg in with_.split():
    4649            pkg_path = pkg + '.path'
    4750            if pkg_path in ctxt.config:
    4851                args.append('--with-%s=%s' % (pkg, ctxt.config[pkg_path]))

comment:2 Changed 7 years ago by thomas.moschny@…

  • Cc thomas.moschny@… added

Release of the first distributions having Python 2.6 is imminent, so can we apply this patch please?

comment:3 Changed 6 years ago by dfraser

  • Owner changed from cmlenz to dfraser
  • Status changed from new to assigned
  • Summary changed from replace with -> with_ in build/ctools (will become a reserved word in Python 2.6) to replace with -> with_ in build/ctools (a reserved word in Python 2.6)

#362 was reported as a duplicate of this

comment:4 Changed 6 years ago by dfraser

  • Resolution set to fixed
  • Status changed from assigned to closed

r581 should fix this

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain dfraser.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.