[yocto] [opkg-utils][PATCH 21/22] opkg.py: use textwrap for description writing
Martin Jansa
martin.jansa at gmail.com
Thu Mar 29 15:22:55 PDT 2012
* description field in oe-core sometimes has extra line-feeds and is long
* extra line-feeds breaks read_control, because empty line means next Package
* long descriptions should be wrapped and properly indented, so they are parsed back properly
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
opkg.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/opkg.py b/opkg.py
index ad3a695..2294160 100644
--- a/opkg.py
+++ b/opkg.py
@@ -42,6 +42,7 @@ import subprocess
from stat import ST_SIZE
import arfile
import tarfile
+import textwrap
class Version:
"""A class for holding parsed package version information."""
@@ -427,7 +428,9 @@ class Package:
if self.installed_size: out = out + "InstalledSize: %d\n" % int(self.installed_size)
if self.filename: out = out + "Filename: %s\n" % (self.filename)
if self.source: out = out + "Source: %s\n" % (self.source)
- if self.description: out = out + "Description: %s\n" % (self.description)
+ if self.description:
+ printable_description = textwrap.dedent(self.description).strip()
+ out = out + "Description: %s\n" % textwrap.fill(printable_description, width=74, initial_indent=' ', subsequent_indent=' ')
if self.oe: out = out + "OE: %s\n" % (self.oe)
if self.homepage: out = out + "HomePage: %s\n" % (self.homepage)
if self.license: out = out + "License: %s\n" % (self.license)
--
1.7.8.5
More information about the yocto
mailing list