]>
Commit | Line | Data |
---|---|---|
95e680c2 JB |
1 | --- logilab-common-0.63.0/cli.py.orig 2014-11-05 15:06:19.000000000 +0100 |
2 | +++ logilab-common-0.63.0/cli.py 2014-11-26 21:24:52.412063809 +0100 | |
3 | @@ -33,11 +33,11 @@ Example:: | |
4 | ||
5 | help_do_pionce = ("pionce", "pionce duree", _("met ton corps en veille")) | |
6 | def do_pionce(self): | |
7 | - print 'nap is good' | |
8 | + print ('nap is good') | |
9 | ||
10 | help_do_ronfle = ("ronfle", "ronfle volume", _("met les autres en veille")) | |
11 | def do_ronfle(self): | |
12 | - print 'fuuuuuuuuuuuu rhhhhhrhrhrrh' | |
13 | + print ('fuuuuuuuuuuuu rhhhhhrhrhrrh') | |
14 | ||
15 | cl = BookShell() | |
16 | """ | |
17 | @@ -66,7 +66,7 @@ def init_readline(complete_method, histf | |
18 | import atexit | |
19 | atexit.register(readline.write_history_file, histfile) | |
20 | except: | |
21 | - print 'readline is not available :-(' | |
22 | + print ('readline is not available :-(') | |
23 | ||
24 | ||
25 | class Completer : | |
26 | @@ -157,9 +157,9 @@ class CLIHelper: | |
27 | return self.commands.keys() | |
28 | ||
29 | def _print_help(self, cmd, syntax, explanation): | |
30 | - print _('Command %s') % cmd | |
31 | - print _('Syntax: %s') % syntax | |
32 | - print '\t', explanation | |
33 | + print (_('Command %s') % cmd) | |
34 | + print (_('Syntax: %s') % syntax) | |
35 | + print ('\t%s' % explanation) | |
36 | ||
37 | ||
38 | ||
39 | @@ -170,20 +170,20 @@ class CLIHelper: | |
40 | if command in self._command_help: | |
41 | self._print_help(*self._command_help[command]) | |
42 | elif command is None or command not in self._topics: | |
43 | - print _("Use help <topic> or help <command>.") | |
44 | - print _("Available topics are:") | |
45 | + print (_("Use help <topic> or help <command>.")) | |
46 | + print (_("Available topics are:")) | |
47 | topics = sorted(self._topics.keys()) | |
48 | for topic in topics: | |
49 | - print '\t', topic | |
50 | + print ('\t%s' % topic) | |
51 | ||
52 | - print _("Available commands are:") | |
53 | + print (_("Available commands are:")) | |
54 | commands = self.commands.keys() | |
55 | commands.sort() | |
56 | for command in commands: | |
57 | - print '\t', command[len(self.CMD_PREFIX):] | |
58 | + print ('\t%s' % command[len(self.CMD_PREFIX):]) | |
59 | ||
60 | else: | |
61 | - print _('Available commands about %s:') % command | |
62 | + print (_('Available commands about %s:') % command) | |
63 | ||
64 | for command_help_method in self._topics[command]: | |
65 | try: | |
66 | @@ -194,8 +194,8 @@ class CLIHelper: | |
67 | except: | |
68 | import traceback | |
69 | traceback.print_exc() | |
70 | - print 'ERROR in help method %s'% ( | |
71 | - command_help_method.__name__) | |
72 | + print ('ERROR in help method %s'% ( | |
73 | + command_help_method.__name__)) | |
74 | ||
75 | help_do_help = ("help", "help [topic|command]", | |
76 | _("print help message for the given topic/command or \ | |
77 | --- logilab-common-0.63.0/daemon.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
78 | +++ logilab-common-0.63.0/daemon.py 2014-11-26 21:22:26.658736590 +0100 | |
79 | @@ -51,7 +51,7 @@ def setugid(user): | |
80 | os.environ['HOME'] = passwd.pw_dir | |
81 | ||
82 | ||
83 | -def daemonize(pidfile=None, uid=None, umask=077): | |
84 | +def daemonize(pidfile=None, uid=None, umask=0o77): | |
85 | """daemonize a Unix process. Set paranoid umask by default. | |
86 | ||
87 | Return 1 in the original process, 2 in the first fork, and None for the | |
88 | @@ -95,7 +95,7 @@ | |
89 | f = file(pidfile, 'w') | |
90 | f.write(str(os.getpid())) | |
91 | f.close() | |
92 | - os.chmod(pidfile, 0644) | |
93 | + os.chmod(pidfile, 0o644) | |
94 | # change process uid | |
95 | if uid: | |
96 | setugid(uid) | |
97 | --- logilab-common-0.63.0/dbf.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
98 | +++ logilab-common-0.63.0/dbf.py 2014-11-26 16:50:57.296086859 +0100 | |
99 | @@ -79,7 +79,7 @@ class Dbase: | |
100 | def open(self, db_name): | |
101 | filesize = os.path.getsize(db_name) | |
102 | if filesize <= 68: | |
103 | - raise IOError, 'The file is not large enough to be a dbf file' | |
104 | + raise IOError('The file is not large enough to be a dbf file') | |
105 | ||
106 | self.fdb = open(db_name, 'rb') | |
107 | ||
108 | @@ -152,7 +152,7 @@ class Dbase: | |
109 | This function accept record number from 0 to N-1 | |
110 | """ | |
111 | if rec_no < 0 or rec_no > self.num_records: | |
112 | - raise Exception, 'Unable to extract data outside the range' | |
113 | + raise Exception('Unable to extract data outside the range') | |
114 | ||
115 | offset = self.header['Record Size'] * rec_no | |
116 | data = self.db_data[offset:offset+self.row_len] | |
117 | @@ -227,4 +227,4 @@ def readDbf(filename): | |
118 | if __name__=='__main__': | |
119 | rec = readDbf('dbf/sptable.dbf') | |
120 | for line in rec: | |
121 | - print '%s %s' % (line['GENUS'].strip(), line['SPECIES'].strip()) | |
122 | + print ('%s %s' % (line['GENUS'].strip(), line['SPECIES'].strip())) | |
123 | --- logilab-common-0.63.0/optparser.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
124 | +++ logilab-common-0.63.0/optparser.py 2014-11-26 16:47:03.622763332 +0100 | |
125 | @@ -55,9 +55,9 @@ class OptionParser(optparse.OptionParser | |
126 | ||
127 | def print_main_help(self): | |
128 | optparse.OptionParser.print_help(self) | |
129 | - print '\ncommands:' | |
130 | + print ('\ncommands:') | |
131 | for cmdname, (_, help) in self._commands.items(): | |
132 | - print '% 10s - %s' % (cmdname, help) | |
133 | + print ('% 10s - %s' % (cmdname, help)) | |
134 | ||
135 | def parse_command(self, args): | |
136 | if len(args) == 0: | |
137 | @@ -78,7 +78,7 @@ | |
138 | # optparse inserts self.description between usage and options help | |
139 | self.description = help | |
140 | if isinstance(mod_or_f, str): | |
141 | - exec 'from %s import run, add_options' % mod_or_f | |
142 | + exec ('from %s import run, add_options' % mod_or_f) | |
143 | else: | |
144 | run, add_options = mod_or_f | |
145 | add_options(self) | |
146 | --- logilab-common-0.63.0/test/data/module2.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
147 | +++ logilab-common-0.63.0/test/data/module2.py 2014-11-26 21:38:42.425362311 +0100 | |
148 | @@ -1,4 +1,5 @@ | |
149 | from data.module import YO, YOUPI | |
150 | +from six import print_ | |
151 | import data | |
152 | ||
153 | class Specialization(YOUPI, YO): pass | |
154 | @@ -38,14 +38,14 @@ | |
155 | ||
156 | del YO | |
157 | [SYN1, SYN2] = Concrete0, Concrete1 | |
158 | -assert `1` | |
159 | +assert repr(1) | |
160 | b = 1 | 2 & 3 ^ 8 | |
161 | -exec 'c = 3' | |
162 | -exec 'c = 3' in {}, {} | |
163 | +exec('c = 3') | |
164 | +exec('c = 3' in {}, {}) | |
165 | ||
166 | def raise_string(a=2, *args, **kwargs): | |
167 | raise 'pas glop' | |
168 | - raise Exception, 'yo' | |
169 | + raise Exception('yo') | |
170 | yield 'coucou' | |
171 | ||
172 | a = b + 2 | |
173 | @@ -66,8 +67,8 @@ e = d[a:b:c] | |
174 | ||
175 | raise_string(*args, **kwargs) | |
176 | ||
177 | -print >> stream, 'bonjour' | |
178 | -print >> stream, 'salut', | |
179 | +print_('bonjour', file=stream) | |
180 | +print_('salut', file=stream) | |
181 | ||
182 | ||
183 | def make_class(any, base=data.module.YO, *args, **kwargs): | |
184 | --- logilab-common-0.63.0/test/data/module.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
185 | +++ logilab-common-0.63.0/test/data/module.py 2014-11-26 21:35:43.185369834 +0100 | |
186 | @@ -5,6 +5,7 @@ | |
187 | ||
188 | from logilab.common import modutils, Execute as spawn | |
189 | from logilab.common.astutils import * | |
190 | +from six import print_ | |
191 | import os.path | |
192 | ||
193 | MY_DICT = {} | |
194 | @@ -21,7 +22,7 @@ def global_access(key, val): | |
195 | else: | |
196 | break | |
197 | else: | |
198 | - print '!!!' | |
199 | + print ('!!!') | |
200 | ||
201 | class YO: | |
202 | """hehe""" | |
203 | @@ -51,9 +52,9 @@ class YOUPI(YO): | |
204 | local = None | |
205 | autre = [a for a, b in MY_DICT if b] | |
206 | if b in autre: | |
207 | - print 'yo', | |
208 | + print_ ('yo', end=' ') | |
209 | elif a in autre: | |
210 | - print 'hehe' | |
211 | + print ('hehe') | |
212 | global_access(local, val=autre) | |
213 | finally: | |
214 | return local | |
215 | @@ -66,7 +66,7 @@ | |
216 | ||
217 | def class_method(cls): | |
218 | """class method test""" | |
219 | - exec a in b | |
220 | + exec(a in b) | |
221 | class_method = classmethod(class_method) | |
222 | ||
223 | ||
224 | @@ -69,19 +70,19 @@ class YOUPI(YO): | |
225 | class_method = classmethod(class_method) | |
226 | ||
227 | ||
228 | -def nested_args(a, (b, c, d)): | |
229 | +def nested_args(a, bcd_tuple): | |
230 | """nested arguments test""" | |
231 | - print a, b, c, d | |
232 | + print_ (a, bcd_tuple[0], ccd_tuple[1], bcd_tuple[2]) | |
233 | while 1: | |
234 | if a: | |
235 | break | |
236 | a += +1 | |
237 | else: | |
238 | - b += -2 | |
239 | - if c: | |
240 | - d = a and b or c | |
241 | + bcd_tuple[0] += -2 | |
242 | + if bcd_tuple[1]: | |
243 | + bcd_tuple[2] = a and bcd_tuple[0] or bcd_tuple[2] | |
244 | else: | |
245 | - c = a and b or d | |
246 | + c = a and bcd_tuple[0] or bcd_tuple[2] | |
247 | map(lambda x, y: (y, x), a) | |
248 | ||
249 | redirect = nested_args | |
250 | --- logilab-common-0.63.0/test/data/noendingnewline.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
251 | +++ logilab-common-0.63.0/test/data/noendingnewline.py 2014-11-26 21:36:18.038701700 +0100 | |
252 | @@ -20,7 +20,7 @@ class TestCase(unittest.TestCase): | |
253 | def xxx(self): | |
254 | if False: | |
255 | pass | |
256 | - print 'a' | |
257 | + print ('a') | |
258 | ||
259 | if False: | |
260 | pass | |
261 | @@ -28,9 +28,9 @@ class TestCase(unittest.TestCase): | |
262 | ||
263 | if False: | |
264 | pass | |
265 | - print 'rara' | |
266 | + print ('rara') | |
267 | ||
268 | ||
269 | if __name__ == '__main__': | |
270 | - print 'test2' | |
271 | + print ('test2') | |
272 | unittest.main() | |
273 | --- logilab-common-0.63.0/test/data/nonregr.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
274 | +++ logilab-common-0.63.0/test/data/nonregr.py 2014-11-26 21:25:29.042062272 +0100 | |
275 | @@ -11,4 +11,4 @@ except NameError: | |
276 | ||
277 | def toto(value): | |
278 | for k, v in value: | |
279 | - print v.get('yo') | |
280 | + print (v.get('yo')) | |
281 | --- logilab-common-0.63.0/test/data/sub/momo.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
282 | +++ logilab-common-0.63.0/test/data/sub/momo.py 2014-11-26 21:38:57.622028341 +0100 | |
283 | @@ -1 +1 @@ | |
284 | -print 'yo' | |
285 | +print('yo') | |
286 | --- logilab-common-0.63.0/urllib2ext.py.orig 2014-11-05 15:06:19.000000000 +0100 | |
287 | +++ logilab-common-0.63.0/urllib2ext.py 2014-11-26 16:46:24.119431660 +0100 | |
288 | @@ -84,4 +84,4 @@ if __name__ == '__main__': | |
289 | # test with url sys.argv[1] | |
290 | h = HTTPGssapiAuthHandler() | |
291 | response = urllib2.build_opener(h, ch).open(sys.argv[1]) | |
292 | - print '\nresponse: %s\n--------------\n' % response.code, response.info() | |
293 | + print ('\nresponse: %s\n--------------\n' % response.code, response.info()) |