Gentoo Archives: gentoo-commits

From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/simpleparse/files: simpleparse-2.1.0_alpha1-python-2.6.patch
Date: Sun, 30 Aug 2009 16:38:23
Message-Id: E1MhsEz-0003Zd-IE@stork.gentoo.org
1 arfrever 09/08/30 21:47:13
2
3 Added: simpleparse-2.1.0_alpha1-python-2.6.patch
4 Log:
5 Fix compatibility with Python 2.6 (without fixing of deprecation warnings) (bug #283167).
6 (Portage version: 14170-svn/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 dev-python/simpleparse/files/simpleparse-2.1.0_alpha1-python-2.6.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/simpleparse/files/simpleparse-2.1.0_alpha1-python-2.6.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-python/simpleparse/files/simpleparse-2.1.0_alpha1-python-2.6.patch?rev=1.1&content-type=text/plain
13
14 Index: simpleparse-2.1.0_alpha1-python-2.6.patch
15 ===================================================================
16 --- stt/TextTools/TextTools.py
17 +++ stt/TextTools/TextTools.py
18 @@ -167,7 +167,7 @@
19 # Extra stuff useful in combination with the C functions
20 #
21
22 -def replace(text,what,with,start=0,stop=None,
23 +def replace(text,what,with_,start=0,stop=None,
24
25 SearchObject=TextSearch,join=join,joinlist=joinlist,tag=tag,
26 string_replace=string.replace,type=type,
27 @@ -188,11 +188,11 @@
28 what = so.match
29 if stop is None:
30 if start == 0 and len(what) < 2:
31 - return string_replace(text,what,with)
32 + return string_replace(text,what,with_)
33 stop = len(text)
34 t = ((text,sWordStart,so,+2),
35 # Found something, replace and continue searching
36 - (with,Skip+AppendTagobj,len(what),-1,-1),
37 + (with_,Skip+AppendTagobj,len(what),-1,-1),
38 # Rest of text
39 (text,Move,ToEOF)
40 )
41 @@ -203,13 +203,13 @@
42
43 # Alternative (usually slower) versions using different techniques:
44
45 -def _replace2(text,what,with,start=0,stop=None,
46 +def _replace2(text,what,with_,start=0,stop=None,
47
48 join=join,joinlist=joinlist,tag=tag,
49 TextSearchType=TextSearchType,TextSearch=TextSearch):
50
51 """Analogon to string.replace; returns a string with all occurences
52 - of what in text[start:stop] replaced by with.
53 + of what in text[start:stop] replaced by with_.
54
55 This version uses a one entry tag-table and a
56 Boyer-Moore-Search-object. what can be a string or a
57 @@ -226,13 +226,13 @@
58 stop = len(text)
59 if type(what) is not TextSearchType:
60 what=TextSearch(what)
61 - t = ((with,sFindWord,what,+1,+0),)
62 + t = ((with_,sFindWord,what,+1,+0),)
63 found,taglist,last = tag(text,t,start,stop)
64 if not found:
65 return text
66 return join(joinlist(text,taglist))
67
68 -def _replace3(text,what,with,
69 +def _replace3(text,what,with_,
70
71 join=string.join,TextSearch=TextSearch,
72 TextSearchType=TextSearchType):
73 @@ -245,12 +245,12 @@
74 l = []
75 x = 0
76 for left,right in slices:
77 - l.append(text[x:left] + with)
78 + l.append(text[x:left] + with_)
79 x = right
80 l.append(text[x:])
81 return join(l,'')
82
83 -def _replace4(text,what,with,
84 +def _replace4(text,what,with_,
85
86 join=join,joinlist=joinlist,tag=tag,TextSearch=TextSearch,
87 TextSearchType=TextSearchType):
88 @@ -262,7 +262,7 @@
89 return text
90 repl = [None]*len(slices)
91 for i in range(len(slices)):
92 - repl[i] = (with,)+slices[i]
93 + repl[i] = (with_,)+slices[i]
94 return join(joinlist(text,repl))
95
96 def multireplace(text,replacements,start=0,stop=None,
97 @@ -569,16 +569,16 @@
98 print 'Replacing strings'
99 print '-'*72
100 print
101 - for what,with in (('m','M'),('mx','MX'),('mxText','MXTEXT'),
102 + for what,with_ in (('m','M'),('mx','MX'),('mxText','MXTEXT'),
103 ('hmm','HMM'),('hmmm','HMM'),('hmhmm','HMM')):
104 - print 'Replace "%s" with "%s"' % (what,with)
105 + print 'Replace "%s" with "%s"' % (what,with_)
106 t.start()
107 for i in range(100):
108 - rtext = string.replace(text,what,with)
109 + rtext = string.replace(text,what,with_)
110 print 'with string.replace:',t.stop(),'sec.'
111 t.start()
112 for i in range(100):
113 - ttext = replace(text,what,with)
114 + ttext = replace(text,what,with_)
115 print 'with tag.replace:',t.stop(),'sec.'
116 if ttext != rtext:
117 print 'results are NOT ok !'
118 @@ -586,7 +586,7 @@
119 mismatch(rtext,ttext)
120 t.start()
121 for i in range(100):
122 - ttext = _replace2(text,what,with)
123 + ttext = _replace2(text,what,with_)
124 print 'with tag._replace2:',t.stop(),'sec.'
125 if ttext != rtext:
126 print 'results are NOT ok !'
127 @@ -594,7 +594,7 @@
128 print rtext
129 t.start()
130 for i in range(100):
131 - ttext = _replace3(text,what,with)
132 + ttext = _replace3(text,what,with_)
133 print 'with tag._replace3:',t.stop(),'sec.'
134 if ttext != rtext:
135 print 'results are NOT ok !'
136 @@ -602,7 +602,7 @@
137 print rtext
138 t.start()
139 for i in range(100):
140 - ttext = _replace4(text,what,with)
141 + ttext = _replace4(text,what,with_)
142 print 'with tag._replace4:',t.stop(),'sec.'
143 if ttext != rtext:
144 print 'results are NOT ok !'