wrap-and-sort: Remove duplicate items from sorted lists.

This commit is contained in:
Benjamin Drung 2010-11-24 21:02:11 +01:00
parent b6582c2c6e
commit ba64f36109
2 changed files with 8 additions and 2 deletions

6
debian/changelog vendored
View File

@ -1,5 +1,6 @@
ubuntu-dev-tools (0.107) UNRELEASED; urgency=low
[ Stefano Rivera ]
* edit-patch: Detect quilt patch-system in 3.0 (quilt) packages without any
patches yet.
* wrap-and-sort:
@ -11,7 +12,10 @@ ubuntu-dev-tools (0.107) UNRELEASED; urgency=low
when unpacking source packages. 3.0 (quilt) has optional per-vendor patch
series.
-- Stefano Rivera <stefanor@ubuntu.com> Wed, 24 Nov 2010 21:31:51 +0200
[ Benjamin Drung ]
* wrap-and-sort: Remove duplicate items from sorted lists.
-- Benjamin Drung <bdrung@ubuntu.com> Wed, 24 Nov 2010 21:00:40 +0100
ubuntu-dev-tools (0.106) experimental; urgency=low

View File

@ -66,10 +66,12 @@ class Control(object):
def _wrap_field(self, control, entry, wrap_always, short_indent, sort=True):
packages = map(lambda x: x.strip(), control[entry].split(","))
if sort:
packages = sort_list(packages)
# Remove duplicate entries
packages = set(packages)
# Not explicitly disallowed by Policy but known to break QA tools:
if "" in packages:
packages.remove("")
packages = sort_list(packages)
length = len(entry) + 2 * len(packages) + sum(map(len, packages))
if wrap_always or length > 80: