Edgewall Software

Ticket #217 (closed defect: fixed)

Opened 7 years ago

Last modified 3 years ago

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

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

Change History

Changed 7 years ago by davidf@…

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

Changed 7 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])) 

Changed 6 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?

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

Changed 6 years ago by dfraser

  • status changed from assigned to closed
  • resolution set to fixed

r581 should fix this

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

Author


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


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.