Package: devscripts
Version: 2.15.1
Severity: normal
Tags: patch

When the debian/install file and similars have superflous empty lines at
the end of the file, they are all moved to the start of the list.  It is
quite annoying.

Attached patch fix this issue.

I used iterator but if you prefere list may be used in place.

(I found this issue when debugging debmake template files.)

I applied this patch to the current unstable package and confirmed
working.  I did not chose to put if in the original self.content line so
empty line with spaces also get removed.

This patch is against current unstable package.  Though, it should be
simple to rebase this to VCS which applies the similar operations to other
files such as "links".

Regards,

Osamu

--- wrap-and-sort.orig	2015-03-17 23:50:58.287803996 +0900
+++ wrap-and-sort	2015-03-17 23:53:29.259804726 +0900
@@ -117,7 +117,8 @@
     def open(self, filename):
         assert os.path.isfile(filename), "%s does not exist." % (filename)
         self.filename = filename
-        self.content = [l.strip() for l in open(filename).readlines()]
+        line_iterator = (l.strip() for l in open(filename).readlines())
+        self.content = [l for l in line_iterator if l !='']
 
     def save(self, filename=None):
         if filename:

Reply via email to