[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 6.0-37-g3088578
Sandro Tosi
morph at debian.org
Sat Aug 27 19:03:31 UTC 2011
The following commit has been merged in the master branch:
commit 3088578aeb85e5e923008918e8899f5e91d190fb
Author: Sandro Tosi <morph at debian.org>
Date: Sat Aug 27 20:56:17 2011 +0200
remove the description from the dependencies list, leaving more space for the useful information (package name and version); thanks to Andreas Beckmann for the report; Closes: #582218
The trick here is to dynamically calculate the width for the package and version
columns, in relation with the other one.
We want to store as much info as possible, but we don't want to use a line
longer than 80 chars, and also without a strict width.
So we compute the column width as the minimum between the max length of the
actual values to show or the space left by the other column.
diff --git a/debian/changelog b/debian/changelog
index 25d3fdf..afef891 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ reportbug (6.2) UNRELEASED; urgency=low
* reportbug/utils.py
- support "Debian Ports" in apt policy info section; thanks to Aurelien
Jarno for the report and patch; Closes: #638357
+ - remove the description from the dependencies list, leaving more space for
+ the useful information (package name and version); thanks to Andreas
+ Beckmann for the report; Closes: #582218
* debian/desktop
- remove deprecated 'Application' category + add GenericName; thanks to Pino
Toscano for the report and patch; Closes: #638964
@@ -41,7 +44,7 @@ reportbug (6.2) UNRELEASED; urgency=low
* reportbug/checkbuildd.py
- fix buildd.d.o checks after the service changes layout; Closes: #612520
- -- Sandro Tosi <morph at debian.org> Sat, 27 Aug 2011 18:58:39 +0200
+ -- Sandro Tosi <morph at debian.org> Sat, 27 Aug 2011 20:53:13 +0200
reportbug (6.1) unstable; urgency=low
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 814134c..f7eee17 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -630,15 +630,30 @@ def get_dependency_info(package, depends, rel="depends on"):
deplist = packs.values()
deplist.sort()
- maxlen = max([len(x[2]) for x in deplist] + [10])
+ deplist2 = []
+ # extract the info we need, also add provides where it fits
for (pack, status, vers, desc, provides) in deplist:
if provides:
pack += ' [' + provides + ']'
-
- packstuff = '%-*.*s %s' % (39-maxlen, 39-maxlen, pack, vers)
-
- info = '%-3.3s %-40.40s %-.34s\n' % (status, packstuff, desc)
+ deplist2.append((pack, vers))
+ deplist = deplist2
+
+ # now we can compute the max possible value for each column, that can be the
+ # max of all its values, or the space left from the other column; this way,
+ # the sum of the 2 fields is never > 73 (hence the resulting line is <80
+ # columns)
+ maxp = max([len(x[0]) for x in deplist])
+ maxv = max([len(x[1]) for x in deplist])
+ widthp = min(maxp, 73-maxv)
+ widthv = min(maxv, 73-maxp)
+
+ for (pack, vers) in deplist:
+ # we format the string specifying to align it in a field of a given
+ # dimension (the first {width*}) but also limit its size (the second
+ # {width*}
+ info = '{0:3.3} {1:{widthp}.{widthp}} {2:{widthv}.{widthv}}\n'.format(
+ status, pack, vers, widthp=widthp, widthv=widthv)
depinfo += info
return depinfo
--
Reportbug - reports bugs in the Debian distribution
More information about the Reportbug-commits
mailing list