#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)
Change History (5)
Changed 17 years ago by davidf@…
comment:1 Changed 17 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
22 22 23 23 __docformat__ = 'restructuredtext en' 24 24 25 def configure(ctxt, file_='configure', enable=None, disable=None, with =None,26 without=None, cflags=None, cxxflags=None ):25 def configure(ctxt, file_='configure', enable=None, disable=None, with_=None, 26 without=None, cflags=None, cxxflags=None, **kw): 27 27 """Run a ``configure`` script. 28 28 29 29 :param ctxt: the build context … … 31 31 :param file\_: name of the configure script 32 32 :param enable: names of the features to enable, seperated by spaces 33 33 :param disable: names of the features to disable, separated by spaces 34 :param with : names of external packages to include34 :param with_: names of external packages to include 35 35 :param without: names of external packages to exclude 36 36 :param cflags: ``CFLAGS`` to pass to the configure script 37 37 :param cxxflags: ``CXXFLAGS`` to pass to the configure script … … 41 41 args += ['--enable-%s' % feature for feature in enable.split()] 42 42 if disable: 43 43 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(): 46 49 pkg_path = pkg + '.path' 47 50 if pkg_path in ctxt.config: 48 51 args.append('--with-%s=%s' % (pkg, ctxt.config[pkg_path]))
comment:2 Changed 16 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 16 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 16 years ago by dfraser
- Resolution set to fixed
- Status changed from assigned to closed
r581 should fix this
Patch that adds a with_ argument to configure, and warns of the deprecation of the with argument