classification
Title: Implement packaging.database.*Distribution.__str__
Type: Stage:
Components: Distutils2 Versions: Python 3.3, 3rd party
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, python-dev, tarek
Priority: normal Keywords:

Created on 2011-10-13 15:52 by eric.araujo, last changed 2012-05-16 17:51 by eric.araujo.

Messages (3)
msg145463 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-13 15:52
In code working with instances of packaging.database.Distribution, it’s bothersome to have to use '%r %s' % (dist.name, dist.version) all the time.  It is also not good-looking in 2.x, where we get u'name'.  I think it would be best to implement a __str__ method on the class and just use %s everywhere, for example in pysetup list and pysetup search.  More sophisticated clients that want to display projects in a GUI can still access dist.name, dist.version and other attributes.

I’ve insisted on using %r for project names and paths to avoid ambiguities with trailing spaces and such hard-to-catch things.  For logging output, we have to pass pure strings, but for direct console printing we could use ANSI escape sequences to display projects’ names in bold for example.
msg160800 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-16 05:07
New changeset ff44594dd3c0 by Guillaume Pratte in branch 'default':
#13166: Implement __str__ on Distribution and EggInfoDistribution, use for pysetup list, pysetup graph and installation log
http://hg.python.org/distutils2/rev/ff44594dd3c0
msg160896 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-05-16 17:51
64b0bf5e0596 reverted the changes to d2.depgraph; more tests need to be added first to make sure the new output is still valid DOT.
History
Date User Action Args
2012-05-16 17:51:55eric.araujosetassignee: tarek -> eric.araujo
messages: + msg160896
title: Implement packaging.database.Distribution.__str__ -> Implement packaging.database.*Distribution.__str__
2012-05-16 05:07:27python-devsetnosy: + python-dev
messages: + msg160800
2011-10-13 15:52:10eric.araujocreate