Ticket #1355: fix-1355.darcs.patch

File fix-1355.darcs.patch, 6.2 KB (added by davidsarah, at 2011-02-21T02:04:30Z)

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.

Line 
11 patch for repository http://tahoe-lafs.org/source/tahoe-lafs/trunk:
2
3Mon Feb 21 02:01:25 GMT Standard Time 2011  david-sarah@jacaranda.org
4  * 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.
5
6New patches:
7
8[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.
9david-sarah@jacaranda.org**20110221020125
10 Ignore-this: b0744ed58f161bf188e037bad077fc48
11] {
12hunk ./src/allmydata/__init__.py 270
13                     pr_ver, pr_loc = pkg_resources_vers_and_locs["distribute"]
14                     if not (os.path.normpath(os.path.realpath(pr_loc)) == os.path.normpath(os.path.realpath(imp_loc))
15                             and imp_comment == "distribute"):
16-                        errors.append("Warning: dependency 'setuptools' found to be version %s of 'distribute' from %r "
17-                                      "by pkg_resources, but 'import setuptools' gave version %s [%s] from %r. "
18-                                      "The version mismatch is expected, but the location mismatch is not."
19+                        errors.append("Warning: dependency 'setuptools' found to be version %r of 'distribute' from %r "
20+                                      "by pkg_resources, but 'import setuptools' gave version %r [%s] from %r. "
21+                                      "A version mismatch is expected, but a location mismatch is not."
22                                       % (pr_ver, pr_loc, imp_ver, imp_comment or 'probably *not* distribute', imp_loc))
23                 else:
24hunk ./src/allmydata/__init__.py 275
25-                    errors.append("Warning: dependency %s (version %s imported from %r) was not found by pkg_resources."
26+                    errors.append("Warning: dependency %r (version %r imported from %r) was not found by pkg_resources."
27                                   % (name, imp_ver, imp_loc))
28                 continue
29 
30hunk ./src/allmydata/__init__.py 283
31             try:
32                 pr_normver = normalized_version(pr_ver)
33             except Exception, e:
34-                errors.append("Warning: version number %s found for dependency '%s' by pkg_resources could not be parsed. "
35-                              "The version found by import was %s from %r. "
36+                errors.append("Warning: version number %r found for dependency %r by pkg_resources could not be parsed. "
37+                              "The version found by import was %r from %r. "
38                               "pkg_resources thought it should be found at %r. "
39                               "The exception was %s: %s"
40hunk ./src/allmydata/__init__.py 287
41-                              % (pr_ver, name, imp_ver, imp_loc, pr_loc, e.__class__.name, e))
42+                              % (pr_ver, name, imp_ver, imp_loc, pr_loc, e.__class__.__name__, e))
43             else:
44                 if imp_ver == 'unknown':
45                     if name not in not_import_versionable:
46hunk ./src/allmydata/__init__.py 291
47-                        errors.append("Warning: unexpectedly could not find a version number for dependency %s imported from %r. "
48-                                      "pkg_resources thought it should be version %s at %r."
49+                        errors.append("Warning: unexpectedly could not find a version number for dependency %r imported from %r. "
50+                                      "pkg_resources thought it should be version %r at %r."
51                                       % (name, imp_loc, pr_ver, pr_loc))
52                 else:
53                     try:
54hunk ./src/allmydata/__init__.py 298
55                         imp_normver = normalized_version(imp_ver)
56                     except Exception, e:
57-                        errors.append("Warning: version number %s found for dependency %s (imported from %r) could not be parsed. "
58-                                      "pkg_resources thought it should be version %s at %r. "
59+                        errors.append("Warning: version number %r found for dependency %r (imported from %r) could not be parsed. "
60+                                      "pkg_resources thought it should be version %r at %r. "
61                                       "The exception was %s: %s"
62hunk ./src/allmydata/__init__.py 301
63-                                      % (imp_ver, name, imp_loc, pr_ver, pr_loc, e.__class__.name, e))
64+                                      % (imp_ver, name, imp_loc, pr_ver, pr_loc, e.__class__.__name__, e))
65                     else:
66                         if pr_ver == 'unknown' or (pr_normver != imp_normver):
67                             if not os.path.normpath(os.path.realpath(pr_loc)) == os.path.normpath(os.path.realpath(imp_loc)):
68hunk ./src/allmydata/__init__.py 305
69-                                errors.append("Warning: dependency '%s' found to have version number %s (normalized to %s, from %r) "
70-                                              "by pkg_resources, but version %s (normalized to %s, from %r) by import."
71+                                errors.append("Warning: dependency %r found to have version number %r (normalized to %r, from %r) "
72+                                              "by pkg_resources, but version %r (normalized to %r, from %r) by import."
73                                               % (name, pr_ver, str(pr_normver), pr_loc, imp_ver, str(imp_normver), imp_loc))
74 
75     imported_packages = set([p.lower() for (p, _) in _vers_and_locs_list])
76hunk ./src/allmydata/__init__.py 312
77     for pr_name, (pr_ver, pr_loc) in pkg_resources_vers_and_locs.iteritems():
78         if pr_name not in imported_packages and pr_name not in ignorable:
79-            errors.append("Warning: dependency %s (version %s) found by pkg_resources not found by import."
80+            errors.append("Warning: dependency %r (version %r) found by pkg_resources not found by import."
81                           % (pr_name, pr_ver))
82 
83     return errors
84}
85
86Context:
87
88[TAG allmydata-tahoe-1.8.2
89warner@lothar.com**20110131020101]
90Patch bundle hash:
913d7a0036ab1ef9bdc6be8fdfc579d8a52194c70c