1 | 1 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk: |
---|
2 | |
---|
3 | Wed Jun 29 19:53:56 BST 2011 david-sarah@jacaranda.org |
---|
4 | * encodingutil: argv and output encodings are always the same on all platforms. Lose the unnecessary generality of them being different. fixes #1120 |
---|
5 | |
---|
6 | New patches: |
---|
7 | |
---|
8 | [encodingutil: argv and output encodings are always the same on all platforms. Lose the unnecessary generality of them being different. fixes #1120 |
---|
9 | david-sarah@jacaranda.org**20110629185356 |
---|
10 | Ignore-this: 5ebacbe6903dfa83ffd3ff8436a97787 |
---|
11 | ] { |
---|
12 | hunk ./src/allmydata/scripts/runner.py 9 |
---|
13 | |
---|
14 | from allmydata.scripts.common import BaseOptions |
---|
15 | from allmydata.scripts import debug, create_node, startstop_node, cli, keygen, stats_gatherer |
---|
16 | -from allmydata.util.encodingutil import quote_output, get_argv_encoding |
---|
17 | +from allmydata.util.encodingutil import quote_output, get_io_encoding |
---|
18 | |
---|
19 | def GROUP(s): |
---|
20 | # Usage.parseOptions compares argv[1] against command[0], so it will |
---|
21 | hunk ./src/allmydata/scripts/runner.py 76 |
---|
22 | c = c.subOptions |
---|
23 | print >>stdout, str(c) |
---|
24 | try: |
---|
25 | - msg = e.args[0].decode(get_argv_encoding()) |
---|
26 | + msg = e.args[0].decode(get_io_encoding()) |
---|
27 | except Exception: |
---|
28 | msg = repr(e) |
---|
29 | print >>stdout, "%s: %s\n" % (sys.argv[0], quote_output(msg, quotemarks=False)) |
---|
30 | hunk ./src/allmydata/test/test_cli.py 35 |
---|
31 | |
---|
32 | from allmydata.util.assertutil import precondition |
---|
33 | from allmydata.util.encodingutil import listdir_unicode, unicode_platform, \ |
---|
34 | - quote_output, get_output_encoding, get_argv_encoding, get_filesystem_encoding, \ |
---|
35 | + quote_output, get_io_encoding, get_filesystem_encoding, \ |
---|
36 | unicode_to_output, unicode_to_argv, to_str |
---|
37 | from allmydata.util.fileutil import abspath_expanduser_unicode |
---|
38 | |
---|
39 | hunk ./src/allmydata/test/test_cli.py 654 |
---|
40 | self.set_up_grid() |
---|
41 | |
---|
42 | try: |
---|
43 | - etudes_arg = u"\u00E9tudes".encode(get_argv_encoding()) |
---|
44 | - lumiere_arg = u"lumi\u00E8re.txt".encode(get_argv_encoding()) |
---|
45 | + etudes_arg = u"\u00E9tudes".encode(get_io_encoding()) |
---|
46 | + lumiere_arg = u"lumi\u00E8re.txt".encode(get_io_encoding()) |
---|
47 | except UnicodeEncodeError: |
---|
48 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
49 | |
---|
50 | hunk ./src/allmydata/test/test_cli.py 983 |
---|
51 | # tahoe put "\u00E0 trier.txt" "\u00E0 trier.txt" |
---|
52 | |
---|
53 | try: |
---|
54 | - a_trier_arg = u"\u00E0 trier.txt".encode(get_argv_encoding()) |
---|
55 | + a_trier_arg = u"\u00E0 trier.txt".encode(get_io_encoding()) |
---|
56 | except UnicodeEncodeError: |
---|
57 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
58 | |
---|
59 | hunk ./src/allmydata/test/test_cli.py 1000 |
---|
60 | d = self.do_cli("create-alias", "tahoe") |
---|
61 | |
---|
62 | d.addCallback(lambda res: |
---|
63 | - self.do_cli("put", rel_fn.encode(get_argv_encoding()), a_trier_arg)) |
---|
64 | + self.do_cli("put", rel_fn.encode(get_io_encoding()), a_trier_arg)) |
---|
65 | def _uploaded((rc, out, err)): |
---|
66 | readcap = out.strip() |
---|
67 | self.failUnless(readcap.startswith("URI:LIT:"), readcap) |
---|
68 | hunk ./src/allmydata/test/test_cli.py 1025 |
---|
69 | # u"g\u00F6\u00F6d" might not be representable in the argv and/or output encodings. |
---|
70 | # It is initially included in the directory in any case. |
---|
71 | try: |
---|
72 | - good_arg = u"g\u00F6\u00F6d".encode(get_argv_encoding()) |
---|
73 | + good_arg = u"g\u00F6\u00F6d".encode(get_io_encoding()) |
---|
74 | except UnicodeEncodeError: |
---|
75 | good_arg = None |
---|
76 | |
---|
77 | hunk ./src/allmydata/test/test_cli.py 1030 |
---|
78 | try: |
---|
79 | - good_out = u"g\u00F6\u00F6d".encode(get_output_encoding()) |
---|
80 | + good_out = u"g\u00F6\u00F6d".encode(get_io_encoding()) |
---|
81 | except UnicodeEncodeError: |
---|
82 | good_out = None |
---|
83 | |
---|
84 | hunk ./src/allmydata/test/test_cli.py 1396 |
---|
85 | |
---|
86 | fn1 = os.path.join(unicode(self.basedir), u"\u00C4rtonwall") |
---|
87 | try: |
---|
88 | - fn1_arg = fn1.encode(get_argv_encoding()) |
---|
89 | - artonwall_arg = u"\u00C4rtonwall".encode(get_argv_encoding()) |
---|
90 | + fn1_arg = fn1.encode(get_io_encoding()) |
---|
91 | + artonwall_arg = u"\u00C4rtonwall".encode(get_io_encoding()) |
---|
92 | except UnicodeEncodeError: |
---|
93 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
94 | |
---|
95 | hunk ./src/allmydata/test/test_cli.py 1435 |
---|
96 | self.failUnlessIn("files whose names could not be converted", err) |
---|
97 | else: |
---|
98 | self.failUnlessReallyEqual(rc, 0) |
---|
99 | - self.failUnlessReallyEqual(out.decode(get_output_encoding()), u"Metallica\n\u00C4rtonwall\n") |
---|
100 | + self.failUnlessReallyEqual(out.decode(get_io_encoding()), u"Metallica\n\u00C4rtonwall\n") |
---|
101 | self.failUnlessReallyEqual(err, "") |
---|
102 | d.addCallback(_check) |
---|
103 | |
---|
104 | hunk ./src/allmydata/test/test_cli.py 1553 |
---|
105 | |
---|
106 | fn1 = os.path.join(unicode(self.basedir), u"\u00C4rtonwall") |
---|
107 | try: |
---|
108 | - fn1_arg = fn1.encode(get_argv_encoding()) |
---|
109 | + fn1_arg = fn1.encode(get_io_encoding()) |
---|
110 | del fn1_arg # hush pyflakes |
---|
111 | hunk ./src/allmydata/test/test_cli.py 1555 |
---|
112 | - artonwall_arg = u"\u00C4rtonwall".encode(get_argv_encoding()) |
---|
113 | + artonwall_arg = u"\u00C4rtonwall".encode(get_io_encoding()) |
---|
114 | except UnicodeEncodeError: |
---|
115 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
116 | |
---|
117 | hunk ./src/allmydata/test/test_cli.py 1577 |
---|
118 | self.failUnlessIn("files whose names could not be converted", err) |
---|
119 | else: |
---|
120 | self.failUnlessReallyEqual(rc, 0) |
---|
121 | - self.failUnlessReallyEqual(out.decode(get_output_encoding()), u"\u00C4rtonwall\n") |
---|
122 | + self.failUnlessReallyEqual(out.decode(get_io_encoding()), u"\u00C4rtonwall\n") |
---|
123 | self.failUnlessReallyEqual(err, "") |
---|
124 | d.addCallback(_check) |
---|
125 | |
---|
126 | hunk ./src/allmydata/test/test_cli.py 1885 |
---|
127 | def test_exclude_options_unicode(self): |
---|
128 | nice_doc = u"nice_d\u00F8c.lyx" |
---|
129 | try: |
---|
130 | - doc_pattern_arg = u"*d\u00F8c*".encode(get_argv_encoding()) |
---|
131 | + doc_pattern_arg = u"*d\u00F8c*".encode(get_io_encoding()) |
---|
132 | except UnicodeEncodeError: |
---|
133 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
134 | |
---|
135 | hunk ./src/allmydata/test/test_cli.py 2520 |
---|
136 | self.set_up_grid() |
---|
137 | |
---|
138 | try: |
---|
139 | - motorhead_arg = u"tahoe:Mot\u00F6rhead".encode(get_argv_encoding()) |
---|
140 | + motorhead_arg = u"tahoe:Mot\u00F6rhead".encode(get_io_encoding()) |
---|
141 | except UnicodeEncodeError: |
---|
142 | raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") |
---|
143 | |
---|
144 | hunk ./src/allmydata/test/test_encodingutil.py 39 |
---|
145 | print " argv = %s" % repr(sys.argv[1]) |
---|
146 | print " platform = '%s'" % sys.platform |
---|
147 | print " filesystem_encoding = '%s'" % sys.getfilesystemencoding() |
---|
148 | - print " output_encoding = '%s'" % sys.stdout.encoding |
---|
149 | - print " argv_encoding = '%s'" % sys.stdout.encoding |
---|
150 | + print " io_encoding = '%s'" % sys.stdout.encoding |
---|
151 | try: |
---|
152 | tmpdir = tempfile.mkdtemp() |
---|
153 | for fname in TEST_FILENAMES: |
---|
154 | hunk ./src/allmydata/test/test_encodingutil.py 67 |
---|
155 | from allmydata.util import encodingutil |
---|
156 | from allmydata.util.encodingutil import argv_to_unicode, unicode_to_url, \ |
---|
157 | unicode_to_output, quote_output, unicode_platform, listdir_unicode, \ |
---|
158 | - FilenameEncodingError, get_output_encoding, get_filesystem_encoding, _reload |
---|
159 | + FilenameEncodingError, get_io_encoding, get_filesystem_encoding, _reload |
---|
160 | from allmydata.dirnode import normalize |
---|
161 | |
---|
162 | from twisted.python import usage |
---|
163 | hunk ./src/allmydata/test/test_encodingutil.py 75 |
---|
164 | class EncodingUtilErrors(ReallyEqualMixin, unittest.TestCase): |
---|
165 | |
---|
166 | @patch('sys.stdout') |
---|
167 | - def test_get_output_encoding(self, mock_stdout): |
---|
168 | + def test_get_io_encoding(self, mock_stdout): |
---|
169 | mock_stdout.encoding = 'UTF-8' |
---|
170 | _reload() |
---|
171 | hunk ./src/allmydata/test/test_encodingutil.py 78 |
---|
172 | - self.failUnlessReallyEqual(get_output_encoding(), 'utf-8') |
---|
173 | + self.failUnlessReallyEqual(get_io_encoding(), 'utf-8') |
---|
174 | |
---|
175 | mock_stdout.encoding = 'cp65001' |
---|
176 | _reload() |
---|
177 | hunk ./src/allmydata/test/test_encodingutil.py 82 |
---|
178 | - self.failUnlessReallyEqual(get_output_encoding(), 'utf-8') |
---|
179 | + self.failUnlessReallyEqual(get_io_encoding(), 'utf-8') |
---|
180 | |
---|
181 | mock_stdout.encoding = 'koi8-r' |
---|
182 | expected = sys.platform == "win32" and 'utf-8' or 'koi8-r' |
---|
183 | hunk ./src/allmydata/test/test_encodingutil.py 87 |
---|
184 | _reload() |
---|
185 | - self.failUnlessReallyEqual(get_output_encoding(), expected) |
---|
186 | + self.failUnlessReallyEqual(get_io_encoding(), expected) |
---|
187 | |
---|
188 | mock_stdout.encoding = 'nonexistent_encoding' |
---|
189 | if sys.platform == "win32": |
---|
190 | hunk ./src/allmydata/test/test_encodingutil.py 92 |
---|
191 | _reload() |
---|
192 | - self.failUnlessReallyEqual(get_output_encoding(), 'utf-8') |
---|
193 | + self.failUnlessReallyEqual(get_io_encoding(), 'utf-8') |
---|
194 | else: |
---|
195 | self.failUnlessRaises(AssertionError, _reload) |
---|
196 | |
---|
197 | hunk ./src/allmydata/test/test_encodingutil.py 97 |
---|
198 | @patch('locale.getpreferredencoding') |
---|
199 | - def test_get_output_encoding_not_from_stdout(self, mock_locale_getpreferredencoding): |
---|
200 | + def test_get_io_encoding_not_from_stdout(self, mock_locale_getpreferredencoding): |
---|
201 | locale # hush pyflakes |
---|
202 | mock_locale_getpreferredencoding.return_value = 'koi8-r' |
---|
203 | |
---|
204 | hunk ./src/allmydata/test/test_encodingutil.py 108 |
---|
205 | try: |
---|
206 | expected = sys.platform == "win32" and 'utf-8' or 'koi8-r' |
---|
207 | _reload() |
---|
208 | - self.failUnlessReallyEqual(get_output_encoding(), expected) |
---|
209 | + self.failUnlessReallyEqual(get_io_encoding(), expected) |
---|
210 | |
---|
211 | sys.stdout.encoding = None |
---|
212 | _reload() |
---|
213 | hunk ./src/allmydata/test/test_encodingutil.py 112 |
---|
214 | - self.failUnlessReallyEqual(get_output_encoding(), expected) |
---|
215 | + self.failUnlessReallyEqual(get_io_encoding(), expected) |
---|
216 | |
---|
217 | mock_locale_getpreferredencoding.return_value = None |
---|
218 | _reload() |
---|
219 | hunk ./src/allmydata/test/test_encodingutil.py 116 |
---|
220 | - self.failUnlessReallyEqual(get_output_encoding(), 'utf-8') |
---|
221 | + self.failUnlessReallyEqual(get_io_encoding(), 'utf-8') |
---|
222 | finally: |
---|
223 | sys.stdout = old_stdout |
---|
224 | |
---|
225 | hunk ./src/allmydata/test/test_encodingutil.py 121 |
---|
226 | def test_argv_to_unicode(self): |
---|
227 | - encodingutil.argv_encoding = 'utf-8' |
---|
228 | + encodingutil.io_encoding = 'utf-8' |
---|
229 | self.failUnlessRaises(usage.UsageError, |
---|
230 | argv_to_unicode, |
---|
231 | lumiere_nfc.encode('latin1')) |
---|
232 | hunk ./src/allmydata/test/test_encodingutil.py 127 |
---|
233 | |
---|
234 | def test_unicode_to_output(self): |
---|
235 | - encodingutil.output_encoding = 'koi8-r' |
---|
236 | + encodingutil.io_encoding = 'koi8-r' |
---|
237 | self.failUnlessRaises(UnicodeEncodeError, unicode_to_output, lumiere_nfc) |
---|
238 | |
---|
239 | @patch('os.listdir') |
---|
240 | hunk ./src/allmydata/test/test_encodingutil.py 193 |
---|
241 | if 'argv' not in dir(self): |
---|
242 | return |
---|
243 | |
---|
244 | - mock.encoding = self.output_encoding |
---|
245 | + mock.encoding = self.io_encoding |
---|
246 | argu = lumiere_nfc |
---|
247 | argv = self.argv |
---|
248 | _reload() |
---|
249 | hunk ./src/allmydata/test/test_encodingutil.py 207 |
---|
250 | if 'argv' not in dir(self): |
---|
251 | return |
---|
252 | |
---|
253 | - mock.encoding = self.output_encoding |
---|
254 | + mock.encoding = self.io_encoding |
---|
255 | _reload() |
---|
256 | self.failUnlessReallyEqual(unicode_to_output(lumiere_nfc), self.argv) |
---|
257 | |
---|
258 | hunk ./src/allmydata/test/test_encodingutil.py 380 |
---|
259 | check(u"\u2621\"", u"'\u2621\"'", True) |
---|
260 | |
---|
261 | def test_quote_output_default(self): |
---|
262 | - encodingutil.output_encoding = 'ascii' |
---|
263 | + encodingutil.io_encoding = 'ascii' |
---|
264 | self.test_quote_output_ascii(None) |
---|
265 | |
---|
266 | hunk ./src/allmydata/test/test_encodingutil.py 383 |
---|
267 | - encodingutil.output_encoding = 'latin1' |
---|
268 | + encodingutil.io_encoding = 'latin1' |
---|
269 | self.test_quote_output_latin1(None) |
---|
270 | |
---|
271 | hunk ./src/allmydata/test/test_encodingutil.py 386 |
---|
272 | - encodingutil.output_encoding = 'utf-8' |
---|
273 | + encodingutil.io_encoding = 'utf-8' |
---|
274 | self.test_quote_output_utf8(None) |
---|
275 | |
---|
276 | |
---|
277 | hunk ./src/allmydata/test/test_encodingutil.py 395 |
---|
278 | argv = 'lumi\xc3\xa8re' |
---|
279 | platform = 'linux2' |
---|
280 | filesystem_encoding = 'UTF-8' |
---|
281 | - output_encoding = 'UTF-8' |
---|
282 | - argv_encoding = 'UTF-8' |
---|
283 | + io_encoding = 'UTF-8' |
---|
284 | dirlist = ['test_file', '\xc3\x84rtonwall.mp3', 'Blah blah.txt'] |
---|
285 | |
---|
286 | class UbuntuKarmicLatin1(EncodingUtil, unittest.TestCase): |
---|
287 | hunk ./src/allmydata/test/test_encodingutil.py 403 |
---|
288 | argv = 'lumi\xe8re' |
---|
289 | platform = 'linux2' |
---|
290 | filesystem_encoding = 'ISO-8859-1' |
---|
291 | - output_encoding = 'ISO-8859-1' |
---|
292 | - argv_encoding = 'ISO-8859-1' |
---|
293 | + io_encoding = 'ISO-8859-1' |
---|
294 | dirlist = ['test_file', 'Blah blah.txt', '\xc4rtonwall.mp3'] |
---|
295 | |
---|
296 | class Windows(EncodingUtil, unittest.TestCase): |
---|
297 | hunk ./src/allmydata/test/test_encodingutil.py 411 |
---|
298 | argv = 'lumi\xc3\xa8re' |
---|
299 | platform = 'win32' |
---|
300 | filesystem_encoding = 'mbcs' |
---|
301 | - output_encoding = 'utf-8' |
---|
302 | - argv_encoding = 'utf-8' |
---|
303 | + io_encoding = 'utf-8' |
---|
304 | dirlist = [u'Blah blah.txt', u'test_file', u'\xc4rtonwall.mp3'] |
---|
305 | |
---|
306 | class MacOSXLeopard(EncodingUtil, unittest.TestCase): |
---|
307 | hunk ./src/allmydata/test/test_encodingutil.py 419 |
---|
308 | output = 'lumi\xc3\xa8re' |
---|
309 | platform = 'darwin' |
---|
310 | filesystem_encoding = 'utf-8' |
---|
311 | - output_encoding = 'UTF-8' |
---|
312 | - argv_encoding = 'UTF-8' |
---|
313 | + io_encoding = 'UTF-8' |
---|
314 | dirlist = [u'A\u0308rtonwall.mp3', u'Blah blah.txt', u'test_file'] |
---|
315 | |
---|
316 | class MacOSXLeopard7bit(EncodingUtil, unittest.TestCase): |
---|
317 | hunk ./src/allmydata/test/test_encodingutil.py 426 |
---|
318 | uname = 'Darwin g5.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC Power Macintosh powerpc' |
---|
319 | platform = 'darwin' |
---|
320 | filesystem_encoding = 'utf-8' |
---|
321 | - output_encoding = 'US-ASCII' |
---|
322 | - argv_encoding = 'US-ASCII' |
---|
323 | + io_encoding = 'US-ASCII' |
---|
324 | dirlist = [u'A\u0308rtonwall.mp3', u'Blah blah.txt', u'test_file'] |
---|
325 | |
---|
326 | class OpenBSD(EncodingUtil, unittest.TestCase): |
---|
327 | hunk ./src/allmydata/test/test_encodingutil.py 433 |
---|
328 | uname = 'OpenBSD 4.1 GENERIC#187 i386 Intel(R) Celeron(R) CPU 2.80GHz ("GenuineIntel" 686-class)' |
---|
329 | platform = 'openbsd4' |
---|
330 | filesystem_encoding = '646' |
---|
331 | - output_encoding = '646' |
---|
332 | - argv_encoding = '646' |
---|
333 | + io_encoding = '646' |
---|
334 | # Oops, I cannot write filenames containing non-ascii characters |
---|
335 | hunk ./src/allmydata/util/encodingutil.py 37 |
---|
336 | raise AssertionError("The character encoding '%s' is not supported for conversion." % (encoding,)) |
---|
337 | |
---|
338 | filesystem_encoding = None |
---|
339 | -output_encoding = None |
---|
340 | -argv_encoding = None |
---|
341 | +io_encoding = None |
---|
342 | is_unicode_platform = False |
---|
343 | |
---|
344 | def _reload(): |
---|
345 | hunk ./src/allmydata/util/encodingutil.py 41 |
---|
346 | - global filesystem_encoding, output_encoding, argv_encoding, is_unicode_platform |
---|
347 | + global filesystem_encoding, io_encoding, is_unicode_platform |
---|
348 | |
---|
349 | filesystem_encoding = canonical_encoding(sys.getfilesystemencoding()) |
---|
350 | check_encoding(filesystem_encoding) |
---|
351 | hunk ./src/allmydata/util/encodingutil.py 49 |
---|
352 | if sys.platform == 'win32': |
---|
353 | # On Windows we install UTF-8 stream wrappers for sys.stdout and |
---|
354 | # sys.stderr, and reencode the arguments as UTF-8 (see scripts/runner.py). |
---|
355 | - output_encoding = 'utf-8' |
---|
356 | + io_encoding = 'utf-8' |
---|
357 | else: |
---|
358 | hunk ./src/allmydata/util/encodingutil.py 51 |
---|
359 | - outenc = None |
---|
360 | + ioenc = None |
---|
361 | if hasattr(sys.stdout, 'encoding'): |
---|
362 | hunk ./src/allmydata/util/encodingutil.py 53 |
---|
363 | - outenc = sys.stdout.encoding |
---|
364 | - if outenc is None: |
---|
365 | + ioenc = sys.stdout.encoding |
---|
366 | + if ioenc is None: |
---|
367 | try: |
---|
368 | hunk ./src/allmydata/util/encodingutil.py 56 |
---|
369 | - outenc = locale.getpreferredencoding() |
---|
370 | + ioenc = locale.getpreferredencoding() |
---|
371 | except Exception: |
---|
372 | pass # work around <http://bugs.python.org/issue1443504> |
---|
373 | hunk ./src/allmydata/util/encodingutil.py 59 |
---|
374 | - output_encoding = canonical_encoding(outenc) |
---|
375 | + io_encoding = canonical_encoding(ioenc) |
---|
376 | |
---|
377 | hunk ./src/allmydata/util/encodingutil.py 61 |
---|
378 | - check_encoding(output_encoding) |
---|
379 | - argv_encoding = output_encoding |
---|
380 | + check_encoding(io_encoding) |
---|
381 | |
---|
382 | is_unicode_platform = sys.platform in ["win32", "darwin"] |
---|
383 | |
---|
384 | hunk ./src/allmydata/util/encodingutil.py 74 |
---|
385 | """ |
---|
386 | return filesystem_encoding |
---|
387 | |
---|
388 | -def get_output_encoding(): |
---|
389 | +def get_io_encoding(): |
---|
390 | """ |
---|
391 | hunk ./src/allmydata/util/encodingutil.py 76 |
---|
392 | - Returns expected encoding for writing to stdout or stderr. |
---|
393 | + Returns expected encoding for writing to stdout or stderr, and for arguments in sys.argv. |
---|
394 | """ |
---|
395 | hunk ./src/allmydata/util/encodingutil.py 78 |
---|
396 | - return output_encoding |
---|
397 | - |
---|
398 | -def get_argv_encoding(): |
---|
399 | - """ |
---|
400 | - Returns expected encoding for command-line arguments. |
---|
401 | - """ |
---|
402 | - return argv_encoding |
---|
403 | + return io_encoding |
---|
404 | |
---|
405 | def argv_to_unicode(s): |
---|
406 | """ |
---|
407 | hunk ./src/allmydata/util/encodingutil.py 87 |
---|
408 | precondition(isinstance(s, str), s) |
---|
409 | |
---|
410 | try: |
---|
411 | - return unicode(s, argv_encoding) |
---|
412 | + return unicode(s, io_encoding) |
---|
413 | except UnicodeDecodeError: |
---|
414 | raise usage.UsageError("Argument %s cannot be decoded as %s." % |
---|
415 | hunk ./src/allmydata/util/encodingutil.py 90 |
---|
416 | - (quote_output(s), argv_encoding)) |
---|
417 | + (quote_output(s), io_encoding)) |
---|
418 | |
---|
419 | def argv_to_abspath(s): |
---|
420 | """ |
---|
421 | hunk ./src/allmydata/util/encodingutil.py 112 |
---|
422 | # This must be the same as 'mangle' in bin/tahoe-script.template. |
---|
423 | return str(re.sub(ur'[^\x20-\x7F]', lambda m: u'\x7F%x;' % (ord(m.group(0)),), s)) |
---|
424 | else: |
---|
425 | - return s.encode(argv_encoding) |
---|
426 | + return s.encode(io_encoding) |
---|
427 | |
---|
428 | def unicode_to_url(s): |
---|
429 | """ |
---|
430 | hunk ./src/allmydata/util/encodingutil.py 143 |
---|
431 | precondition(isinstance(s, unicode), s) |
---|
432 | |
---|
433 | try: |
---|
434 | - out = s.encode(output_encoding) |
---|
435 | + out = s.encode(io_encoding) |
---|
436 | except (UnicodeEncodeError, UnicodeDecodeError): |
---|
437 | hunk ./src/allmydata/util/encodingutil.py 145 |
---|
438 | - raise UnicodeEncodeError(output_encoding, s, 0, 0, |
---|
439 | + raise UnicodeEncodeError(io_encoding, s, 0, 0, |
---|
440 | "A string could not be encoded as %s for output to the terminal:\n%r" % |
---|
441 | hunk ./src/allmydata/util/encodingutil.py 147 |
---|
442 | - (output_encoding, repr(s))) |
---|
443 | + (io_encoding, repr(s))) |
---|
444 | |
---|
445 | if PRINTABLE_8BIT.search(out) is None: |
---|
446 | hunk ./src/allmydata/util/encodingutil.py 150 |
---|
447 | - raise UnicodeEncodeError(output_encoding, s, 0, 0, |
---|
448 | + raise UnicodeEncodeError(io_encoding, s, 0, 0, |
---|
449 | "A string encoded as %s for output to the terminal contained unsafe bytes:\n%r" % |
---|
450 | hunk ./src/allmydata/util/encodingutil.py 152 |
---|
451 | - (output_encoding, repr(s))) |
---|
452 | + (io_encoding, repr(s))) |
---|
453 | return out |
---|
454 | |
---|
455 | |
---|
456 | hunk ./src/allmydata/util/encodingutil.py 207 |
---|
457 | |
---|
458 | if MUST_DOUBLE_QUOTE.search(s) is None: |
---|
459 | try: |
---|
460 | - out = s.encode(encoding or output_encoding) |
---|
461 | + out = s.encode(encoding or io_encoding) |
---|
462 | if quotemarks or out.startswith('"'): |
---|
463 | return "'%s'" % (out,) |
---|
464 | else: |
---|
465 | hunk ./src/allmydata/util/encodingutil.py 216 |
---|
466 | pass |
---|
467 | |
---|
468 | escaped = ESCAPABLE_UNICODE.sub(_unicode_escape, s) |
---|
469 | - return '"%s"' % (escaped.encode(encoding or output_encoding, 'backslashreplace'),) |
---|
470 | + return '"%s"' % (escaped.encode(encoding or io_encoding, 'backslashreplace'),) |
---|
471 | |
---|
472 | def quote_path(path, quotemarks=True): |
---|
473 | return quote_output("/".join(map(to_str, path)), quotemarks=quotemarks) |
---|
474 | } |
---|
475 | |
---|
476 | Context: |
---|
477 | |
---|
478 | [docs: three minor fixes |
---|
479 | zooko@zooko.com**20110610121656 |
---|
480 | Ignore-this: fec96579eb95aceb2ad5fc01a814c8a2 |
---|
481 | CREDITS for arc for stats tweak |
---|
482 | fix link to .zip file in quickstart.rst (thanks to ChosenOne for noticing) |
---|
483 | English usage tweak |
---|
484 | ] |
---|
485 | [server.py: get_latencies now reports percentiles _only_ if there are sufficient observations for the interpretation of the percentile to be unambiguous. |
---|
486 | wilcoxjg@gmail.com**20110527120135 |
---|
487 | Ignore-this: 2e7029764bffc60e26f471d7c2b6611e |
---|
488 | interfaces.py: modified the return type of RIStatsProvider.get_stats to allow for None as a return value |
---|
489 | NEWS.rst, stats.py: documentation of change to get_latencies |
---|
490 | stats.rst: now documents percentile modification in get_latencies |
---|
491 | test_storage.py: test_latencies now expects None in output categories that contain too few samples for the associated percentile to be unambiguously reported. |
---|
492 | fixes #1392 |
---|
493 | ] |
---|
494 | [corrected "k must never be smaller than N" to "k must never be greater than N" |
---|
495 | secorp@allmydata.org**20110425010308 |
---|
496 | Ignore-this: 233129505d6c70860087f22541805eac |
---|
497 | ] |
---|
498 | [docs/running.rst: fix stray HTML (not .rst) link noticed by ChosenOne. |
---|
499 | david-sarah@jacaranda.org**20110609223719 |
---|
500 | Ignore-this: fc50ac9c94792dcac6f1067df8ac0d4a |
---|
501 | ] |
---|
502 | [docs: revert link in relnotes.txt from NEWS.rst to NEWS, since the former did not exist at revision 5000. |
---|
503 | david-sarah@jacaranda.org**20110517011214 |
---|
504 | Ignore-this: 6a5be6e70241e3ec0575641f64343df7 |
---|
505 | ] |
---|
506 | [docs: convert NEWS to NEWS.rst and change all references to it. |
---|
507 | david-sarah@jacaranda.org**20110517010255 |
---|
508 | Ignore-this: a820b93ea10577c77e9c8206dbfe770d |
---|
509 | ] |
---|
510 | [docs: remove out-of-date docs/testgrid/introducer.furl and containing directory. fixes #1404 |
---|
511 | david-sarah@jacaranda.org**20110512140559 |
---|
512 | Ignore-this: 784548fc5367fac5450df1c46890876d |
---|
513 | ] |
---|
514 | [scripts/common.py: don't assume that the default alias is always 'tahoe' (it is, but the API of get_alias doesn't say so). refs #1342 |
---|
515 | david-sarah@jacaranda.org**20110130164923 |
---|
516 | Ignore-this: a271e77ce81d84bb4c43645b891d92eb |
---|
517 | ] |
---|
518 | [setup: don't catch all Exception from check_requirement(), but only PackagingError and ImportError |
---|
519 | zooko@zooko.com**20110128142006 |
---|
520 | Ignore-this: 57d4bc9298b711e4bc9dc832c75295de |
---|
521 | I noticed this because I had accidentally inserted a bug which caused AssertionError to be raised from check_requirement(). |
---|
522 | ] |
---|
523 | [M-x whitespace-cleanup |
---|
524 | zooko@zooko.com**20110510193653 |
---|
525 | Ignore-this: dea02f831298c0f65ad096960e7df5c7 |
---|
526 | ] |
---|
527 | [docs: fix typo in running.rst, thanks to arch_o_median |
---|
528 | zooko@zooko.com**20110510193633 |
---|
529 | Ignore-this: ca06de166a46abbc61140513918e79e8 |
---|
530 | ] |
---|
531 | [relnotes.txt: don't claim to work on Cygwin (which has been untested for some time). refs #1342 |
---|
532 | david-sarah@jacaranda.org**20110204204902 |
---|
533 | Ignore-this: 85ef118a48453d93fa4cddc32d65b25b |
---|
534 | ] |
---|
535 | [relnotes.txt: forseeable -> foreseeable. refs #1342 |
---|
536 | david-sarah@jacaranda.org**20110204204116 |
---|
537 | Ignore-this: 746debc4d82f4031ebf75ab4031b3a9 |
---|
538 | ] |
---|
539 | [replace remaining .html docs with .rst docs |
---|
540 | zooko@zooko.com**20110510191650 |
---|
541 | Ignore-this: d557d960a986d4ac8216d1677d236399 |
---|
542 | Remove install.html (long since deprecated). |
---|
543 | Also replace some obsolete references to install.html with references to quickstart.rst. |
---|
544 | Fix some broken internal references within docs/historical/historical_known_issues.txt. |
---|
545 | Thanks to Ravi Pinjala and Patrick McDonald. |
---|
546 | refs #1227 |
---|
547 | ] |
---|
548 | [docs: FTP-and-SFTP.rst: fix a minor error and update the information about which version of Twisted fixes #1297 |
---|
549 | zooko@zooko.com**20110428055232 |
---|
550 | Ignore-this: b63cfb4ebdbe32fb3b5f885255db4d39 |
---|
551 | ] |
---|
552 | [munin tahoe_files plugin: fix incorrect file count |
---|
553 | francois@ctrlaltdel.ch**20110428055312 |
---|
554 | Ignore-this: 334ba49a0bbd93b4a7b06a25697aba34 |
---|
555 | fixes #1391 |
---|
556 | ] |
---|
557 | [Fix a test failure in test_package_initialization on Python 2.4.x due to exceptions being stringified differently than in later versions of Python. refs #1389 |
---|
558 | david-sarah@jacaranda.org**20110411190738 |
---|
559 | Ignore-this: 7847d26bc117c328c679f08a7baee519 |
---|
560 | ] |
---|
561 | [tests: add test for including the ImportError message and traceback entry in the summary of errors from importing dependencies. refs #1389 |
---|
562 | david-sarah@jacaranda.org**20110410155844 |
---|
563 | Ignore-this: fbecdbeb0d06a0f875fe8d4030aabafa |
---|
564 | ] |
---|
565 | [allmydata/__init__.py: preserve the message and last traceback entry (file, line number, function, and source line) of ImportErrors in the package versions string. fixes #1389 |
---|
566 | david-sarah@jacaranda.org**20110410155705 |
---|
567 | Ignore-this: 2f87b8b327906cf8bfca9440a0904900 |
---|
568 | ] |
---|
569 | [remove unused variable detected by pyflakes |
---|
570 | zooko@zooko.com**20110407172231 |
---|
571 | Ignore-this: 7344652d5e0720af822070d91f03daf9 |
---|
572 | ] |
---|
573 | [allmydata/__init__.py: Nicer reporting of unparseable version numbers in dependencies. fixes #1388 |
---|
574 | david-sarah@jacaranda.org**20110401202750 |
---|
575 | Ignore-this: 9c6bd599259d2405e1caadbb3e0d8c7f |
---|
576 | ] |
---|
577 | [update FTP-and-SFTP.rst: the necessary patch is included in Twisted-10.1 |
---|
578 | Brian Warner <warner@lothar.com>**20110325232511 |
---|
579 | Ignore-this: d5307faa6900f143193bfbe14e0f01a |
---|
580 | ] |
---|
581 | [control.py: remove all uses of s.get_serverid() |
---|
582 | warner@lothar.com**20110227011203 |
---|
583 | Ignore-this: f80a787953bd7fa3d40e828bde00e855 |
---|
584 | ] |
---|
585 | [web: remove some uses of s.get_serverid(), not all |
---|
586 | warner@lothar.com**20110227011159 |
---|
587 | Ignore-this: a9347d9cf6436537a47edc6efde9f8be |
---|
588 | ] |
---|
589 | [immutable/downloader/fetcher.py: remove all get_serverid() calls |
---|
590 | warner@lothar.com**20110227011156 |
---|
591 | Ignore-this: fb5ef018ade1749348b546ec24f7f09a |
---|
592 | ] |
---|
593 | [immutable/downloader/fetcher.py: fix diversity bug in server-response handling |
---|
594 | warner@lothar.com**20110227011153 |
---|
595 | Ignore-this: bcd62232c9159371ae8a16ff63d22c1b |
---|
596 | |
---|
597 | When blocks terminate (either COMPLETE or CORRUPT/DEAD/BADSEGNUM), the |
---|
598 | _shares_from_server dict was being popped incorrectly (using shnum as the |
---|
599 | index instead of serverid). I'm still thinking through the consequences of |
---|
600 | this bug. It was probably benign and really hard to detect. I think it would |
---|
601 | cause us to incorrectly believe that we're pulling too many shares from a |
---|
602 | server, and thus prefer a different server rather than asking for a second |
---|
603 | share from the first server. The diversity code is intended to spread out the |
---|
604 | number of shares simultaneously being requested from each server, but with |
---|
605 | this bug, it might be spreading out the total number of shares requested at |
---|
606 | all, not just simultaneously. (note that SegmentFetcher is scoped to a single |
---|
607 | segment, so the effect doesn't last very long). |
---|
608 | ] |
---|
609 | [immutable/downloader/share.py: reduce get_serverid(), one left, update ext deps |
---|
610 | warner@lothar.com**20110227011150 |
---|
611 | Ignore-this: d8d56dd8e7b280792b40105e13664554 |
---|
612 | |
---|
613 | test_download.py: create+check MyShare instances better, make sure they share |
---|
614 | Server objects, now that finder.py cares |
---|
615 | ] |
---|
616 | [immutable/downloader/finder.py: reduce use of get_serverid(), one left |
---|
617 | warner@lothar.com**20110227011146 |
---|
618 | Ignore-this: 5785be173b491ae8a78faf5142892020 |
---|
619 | ] |
---|
620 | [immutable/offloaded.py: reduce use of get_serverid() a bit more |
---|
621 | warner@lothar.com**20110227011142 |
---|
622 | Ignore-this: b48acc1b2ae1b311da7f3ba4ffba38f |
---|
623 | ] |
---|
624 | [immutable/upload.py: reduce use of get_serverid() |
---|
625 | warner@lothar.com**20110227011138 |
---|
626 | Ignore-this: ffdd7ff32bca890782119a6e9f1495f6 |
---|
627 | ] |
---|
628 | [immutable/checker.py: remove some uses of s.get_serverid(), not all |
---|
629 | warner@lothar.com**20110227011134 |
---|
630 | Ignore-this: e480a37efa9e94e8016d826c492f626e |
---|
631 | ] |
---|
632 | [add remaining get_* methods to storage_client.Server, NoNetworkServer, and |
---|
633 | warner@lothar.com**20110227011132 |
---|
634 | Ignore-this: 6078279ddf42b179996a4b53bee8c421 |
---|
635 | MockIServer stubs |
---|
636 | ] |
---|
637 | [upload.py: rearrange _make_trackers a bit, no behavior changes |
---|
638 | warner@lothar.com**20110227011128 |
---|
639 | Ignore-this: 296d4819e2af452b107177aef6ebb40f |
---|
640 | ] |
---|
641 | [happinessutil.py: finally rename merge_peers to merge_servers |
---|
642 | warner@lothar.com**20110227011124 |
---|
643 | Ignore-this: c8cd381fea1dd888899cb71e4f86de6e |
---|
644 | ] |
---|
645 | [test_upload.py: factor out FakeServerTracker |
---|
646 | warner@lothar.com**20110227011120 |
---|
647 | Ignore-this: 6c182cba90e908221099472cc159325b |
---|
648 | ] |
---|
649 | [test_upload.py: server-vs-tracker cleanup |
---|
650 | warner@lothar.com**20110227011115 |
---|
651 | Ignore-this: 2915133be1a3ba456e8603885437e03 |
---|
652 | ] |
---|
653 | [happinessutil.py: server-vs-tracker cleanup |
---|
654 | warner@lothar.com**20110227011111 |
---|
655 | Ignore-this: b856c84033562d7d718cae7cb01085a9 |
---|
656 | ] |
---|
657 | [upload.py: more tracker-vs-server cleanup |
---|
658 | warner@lothar.com**20110227011107 |
---|
659 | Ignore-this: bb75ed2afef55e47c085b35def2de315 |
---|
660 | ] |
---|
661 | [upload.py: fix var names to avoid confusion between 'trackers' and 'servers' |
---|
662 | warner@lothar.com**20110227011103 |
---|
663 | Ignore-this: 5d5e3415b7d2732d92f42413c25d205d |
---|
664 | ] |
---|
665 | [refactor: s/peer/server/ in immutable/upload, happinessutil.py, test_upload |
---|
666 | warner@lothar.com**20110227011100 |
---|
667 | Ignore-this: 7ea858755cbe5896ac212a925840fe68 |
---|
668 | |
---|
669 | No behavioral changes, just updating variable/method names and log messages. |
---|
670 | The effects outside these three files should be minimal: some exception |
---|
671 | messages changed (to say "server" instead of "peer"), and some internal class |
---|
672 | names were changed. A few things still use "peer" to minimize external |
---|
673 | changes, like UploadResults.timings["peer_selection"] and |
---|
674 | happinessutil.merge_peers, which can be changed later. |
---|
675 | ] |
---|
676 | [storage_client.py: clean up test_add_server/test_add_descriptor, remove .test_servers |
---|
677 | warner@lothar.com**20110227011056 |
---|
678 | Ignore-this: efad933e78179d3d5fdcd6d1ef2b19cc |
---|
679 | ] |
---|
680 | [test_client.py, upload.py:: remove KiB/MiB/etc constants, and other dead code |
---|
681 | warner@lothar.com**20110227011051 |
---|
682 | Ignore-this: dc83c5794c2afc4f81e592f689c0dc2d |
---|
683 | ] |
---|
684 | [test: increase timeout on a network test because Francois's ARM machine hit that timeout |
---|
685 | zooko@zooko.com**20110317165909 |
---|
686 | Ignore-this: 380c345cdcbd196268ca5b65664ac85b |
---|
687 | I'm skeptical that the test was proceeding correctly but ran out of time. It seems more likely that it had gotten hung. But if we raise the timeout to an even more extravagant number then we can be even more certain that the test was never going to finish. |
---|
688 | ] |
---|
689 | [docs/configuration.rst: add a "Frontend Configuration" section |
---|
690 | Brian Warner <warner@lothar.com>**20110222014323 |
---|
691 | Ignore-this: 657018aa501fe4f0efef9851628444ca |
---|
692 | |
---|
693 | this points to docs/frontends/*.rst, which were previously underlinked |
---|
694 | ] |
---|
695 | [web/filenode.py: avoid calling req.finish() on closed HTTP connections. Closes #1366 |
---|
696 | "Brian Warner <warner@lothar.com>"**20110221061544 |
---|
697 | Ignore-this: 799d4de19933f2309b3c0c19a63bb888 |
---|
698 | ] |
---|
699 | [Add unit tests for cross_check_pkg_resources_versus_import, and a regression test for ref #1355. This requires a little refactoring to make it testable. |
---|
700 | david-sarah@jacaranda.org**20110221015817 |
---|
701 | Ignore-this: 51d181698f8c20d3aca58b057e9c475a |
---|
702 | ] |
---|
703 | [allmydata/__init__.py: .name was used in place of the correct .__name__ when printing an exception. Also, robustify string formatting by using %r instead of %s in some places. fixes #1355. |
---|
704 | david-sarah@jacaranda.org**20110221020125 |
---|
705 | Ignore-this: b0744ed58f161bf188e037bad077fc48 |
---|
706 | ] |
---|
707 | [Refactor StorageFarmBroker handling of servers |
---|
708 | Brian Warner <warner@lothar.com>**20110221015804 |
---|
709 | Ignore-this: 842144ed92f5717699b8f580eab32a51 |
---|
710 | |
---|
711 | Pass around IServer instance instead of (peerid, rref) tuple. Replace |
---|
712 | "descriptor" with "server". Other replacements: |
---|
713 | |
---|
714 | get_all_servers -> get_connected_servers/get_known_servers |
---|
715 | get_servers_for_index -> get_servers_for_psi (now returns IServers) |
---|
716 | |
---|
717 | This change still needs to be pushed further down: lots of code is now |
---|
718 | getting the IServer and then distributing (peerid, rref) internally. |
---|
719 | Instead, it ought to distribute the IServer internally and delay |
---|
720 | extracting a serverid or rref until the last moment. |
---|
721 | |
---|
722 | no_network.py was updated to retain parallelism. |
---|
723 | ] |
---|
724 | [TAG allmydata-tahoe-1.8.2 |
---|
725 | warner@lothar.com**20110131020101] |
---|
726 | Patch bundle hash: |
---|
727 | 8cce5d52faf7c20173c0063328e1bb85e08a7328 |
---|