Package: devscripts
Version: 2.15.5
Severity: wishlist
Tags: patch
Hi,
If you have zero-byte (eg.) debian/copyright file, running wrap-and-sort
will actually *add* a trailing newline instead of keeping it at zero
bytes as you might expect.
Patch attached.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/scripts/wrap-and-sort b/scripts/wrap-and-sort
index f3a7e55..98a4bb5 100755
--- a/scripts/wrap-and-sort
+++ b/scripts/wrap-and-sort
@@ -145,7 +145,10 @@ class Install(object):
def remove_trailing_whitespaces(filename):
assert os.path.isfile(filename), "%s does not exist." % (filename)
- content = open(filename).read().rstrip() + "\n"
+ content = open(filename).read()
+ if len(content) == 0:
+ return
+ content = content.rstrip() + "\n"
lines = content.split("\n")
lines = [l.rstrip() for l in lines]
new_content = "\n".join(lines)
_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel