[Python-modules-commits] r15756 - in packages/python-whoosh/trunk/debian (2 files)
aelmahmoudy-guest at users.alioth.debian.org
aelmahmoudy-guest at users.alioth.debian.org
Fri Feb 18 08:39:09 UTC 2011
Date: Friday, February 18, 2011 @ 08:39:04
Author: aelmahmoudy-guest
Revision: 15756
* Added fix_methodcaller_import.diff patch which fixes import of
methodcaller, which was only added in Python 2.6.
* debian/control: Set XS-Python-Version back to 2.5
Added:
packages/python-whoosh/trunk/debian/patches/fix_methodcaller_import.diff
Modified:
packages/python-whoosh/trunk/debian/control
Modified: packages/python-whoosh/trunk/debian/control
===================================================================
--- packages/python-whoosh/trunk/debian/control 2011-02-18 02:14:13 UTC (rev 15755)
+++ packages/python-whoosh/trunk/debian/control 2011-02-18 08:39:04 UTC (rev 15756)
@@ -7,7 +7,7 @@
Build-Depends-Indep: python-sphinx, python-all (>= 2.6.6-2)
Standards-Version: 3.9.1
Homepage: http://whoosh.ca/
-XS-Python-Version: >= 2.6
+XS-Python-Version: >= 2.5
Vcs-Svn: svn://svn.debian.org/python-modules/packages/python-whoosh/trunk/
Vcs-Browser: http://svn.debian.org/viewsvn/python-modules/packages/python-whoosh/trunk/
DM-Upload-Allowed: yes
Added: packages/python-whoosh/trunk/debian/patches/fix_methodcaller_import.diff
===================================================================
--- packages/python-whoosh/trunk/debian/patches/fix_methodcaller_import.diff (rev 0)
+++ packages/python-whoosh/trunk/debian/patches/fix_methodcaller_import.diff 2011-02-18 08:39:04 UTC (rev 15756)
@@ -0,0 +1,60 @@
+Description: Fixed import of methodcaller, which was only added in Python 2.6.
+Origin: https://bitbucket.org/mchaput/whoosh/changeset/8a5a6ee1c272
+Author: Matt Chaput <matt at whoosh.ca>
+Bug: https://bitbucket.org/mchaput/whoosh/issue/110
+
+--- a/src/whoosh/query.py
++++ b/src/whoosh/query.py
+@@ -22,7 +22,6 @@
+
+ import copy
+ import fnmatch
+-import operator
+ import re
+ from array import array
+
+@@ -35,7 +34,7 @@
+ from whoosh.reading import TermNotFound
+ from whoosh.support.levenshtein import relative
+ from whoosh.support.times import datetime_to_long
+-from whoosh.util import make_binary_tree
++from whoosh.util import make_binary_tree, methodcaller
+
+
+ # Exceptions
+@@ -176,7 +175,7 @@
+ if self.is_leaf():
+ return copy.copy(self)
+ else:
+- return self.apply(operator.methodcaller("copy"))
++ return self.apply(methodcaller("copy"))
+
+ def replace(self, oldtext, newtext):
+ """Returns a copy of this query with oldtext replaced by newtext (if
+@@ -189,7 +188,7 @@
+ if self.is_leaf():
+ return self.copy()
+ else:
+- return self.apply(operator.methodcaller("replace", oldtext, newtext))
++ return self.apply(methodcaller("replace", oldtext, newtext))
+
+ def all_terms(self, termset=None, phrases=True):
+ """Returns a set of all terms in this query tree.
+--- a/src/whoosh/util.py
++++ b/src/whoosh/util.py
+@@ -60,6 +60,15 @@
+ return
+
+
++try:
++ from operator import methodcaller
++except ImportError:
++ def methodcaller(name, *args, **kwargs):
++ def caller(obj):
++ return getattr(obj, name)(*args, **kwargs)
++ return caller
++
++
+ if sys.platform == 'win32':
+ now = time.clock
+ else:
More information about the Python-modules-commits
mailing list