Bug#814449: [wrap-and-sort] to remove double or more spaces

Herbert Fortes (hpfn) hpfn at ig.com.br
Thu Feb 11 16:49:28 UTC 2016


Package: devscripts
Version: 2.15.10
Severity: wishlist
File: /usr/bin/wrap-and-sort

Hi,

The wrap-and-sort script has:

def remove_trailing_whitespaces(filename):

But it doesn't remove double or more spaces
inside a line. e.g:

' text which belongs to     long description.   End of line'

I'm not a programmer, but I did a search and added
a line to do that. I copied these lines and made a
test:

#!/usr/bin/python3

import re

 content = open("control").read().rstrip() + "\n"
 lines = content.split("\n")
 lines = [l.rstrip() for l in lines]
+lines = [re.sub('\s+', ' ', l) for l in lines]
 new_content = "\n".join(lines)
 f = open("control", "w")
 f.write(new_content)
 f.close()


The line I added doesn't remove all spaces at the 
end of the line. That's why two for loops. It works
in a separate test script. But I put it in wrap-and-sort
and it didn't.

It can be useful for long description in debian/control.
I don't know about the others files.


regards,
-- 
Herbert Parentes Fortes Neto (hpfn)



More information about the devscripts-devel mailing list