msg160381 - (view) |
Author: Nick Wilson (nick.wilson) * |
Date: 2012-05-10 23:14 |
IrrationalVersionError in packaging/distutils2 should include the name of the project responsible for the error. It currently only includes the version: >>> import packaging.pypi.xmlrpc >>> client = packaging.pypi.xmlrpc.Client() >>> client.search_projects('req') Irrational version error found: 0.0.0-prealpha Irrational version error found: 0.1dev-20110502 ... |
|
|
msg160383 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-05-10 23:40 |
Setting to easy for the next sprints. To do: add an argument to the IrrationalVersion constructor, add a test to make sure the result of __str__ includes it, and adapt the rest of the codebase to pass the project name when the exception is raised. |
|
|
msg160630 - (view) |
Author: Christoph Echtinger-Sieghart (sigi) * |
Date: 2012-05-14 15:52 |
I took a look at the code and I don't think that adding an argument to the IrrationalVersionError constructor is the right way to go. The exception is raised in places where we don't know for which project we are raising the exception (eg in packaging.version.NormalizedVersion). Wouldn't it be better to make packaging.pypi.xmlrpc.Client just print the package name with the exception? I would be glad to contribute a patch. |
|
|
msg160632 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-05-14 16:11 |
You are right. When the NormalizedVersion class is used standalone, there is no project name to pass, so it is the responsibility of higher-level code (the Metadata class I think here) to raise or log messages including the project name. To make a patch, you can use the hg.python.org/distutils2 repo (also mirrored on Bitbucket under the python_mirrors user account for easing cloning) or the CPython repository. Thanks! |
|
|
msg160634 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2012-05-14 16:12 |
BTW there could be an optional argument in the exception constructor for the project name, but that does not seem clean to me. |
|
|
msg160659 - (view) |
Author: Christoph Echtinger-Sieghart (sigi) * |
Date: 2012-05-14 19:55 |
The optional argument approach doesn't seem clean to me either. I think the correct approach is - as you wrote - to change the higher level code to include the project name in the exception message. |
|
|
msg160665 - (view) |
Author: Christoph Echtinger-Sieghart (sigi) * |
Date: 2012-05-14 20:38 |
I wrote a trivial patch against the CPython repository that adds the name to the exception message. Did I forget anything? What kind of test would make sense? |
|
|
msg213245 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2014-03-12 10:41 |
distutils2 development has stopped. |
|
|