[sysadmin-bin] ftpadmin: remove spaces and newlines when it makes sense (hopefully)



commit 774d002b109592f0a2599dac47be075afd8c04ba
Author: Olav Vitters <olav vitters nl>
Date:   Sun Mar 27 16:33:39 2011 +0200

    ftpadmin: remove spaces and newlines when it makes sense (hopefully)

 ftpadmin |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/ftpadmin b/ftpadmin
index 7859816..e85429e 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -48,6 +48,7 @@ re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+
 re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')
 re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')
 re_who = re.compile(r' <[^>]+>$')
+re_whitespace = re.compile("\s+")
 
 SECTIONS = [
         'sources',
@@ -1027,6 +1028,7 @@ Install %s? [Y/n]""" % self.module,
             self._print_header(mail, "About %s" % (modulename or self.module))
             print >>mail, ""
             for paragraph in desc.split("\n\n"):
+                if "\n" in paragraph: paragraph = re_whitespace.sub(" ", paragraph)
                 print >>mail, textwrap.fill(paragraph)
                 print >>mail, ""
             if "\n\n" in desc:
@@ -1361,6 +1363,7 @@ def cmd_show_doap(options, parser):
     moduleinfo = ModuleInfo(options.module)
     desc = moduleinfo.get_one_from_doap('description', '')
     for paragraph in desc.split("\n\n"):
+        if "\n" in paragraph: paragraph = re_whitespace.sub(" ", paragraph)
         print textwrap.fill(paragraph)
         print ""
     bz = moduleinfo.get_bz_product_from_doap()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]