diff options
author | Alec Warner <antarus@gentoo.org> | 2008-07-21 05:41:07 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2008-07-21 05:41:07 +0000 |
commit | 69d103df4a2c083ca8449fcb5704ffa75007b466 (patch) | |
tree | b4e9f101aa840a3c3e56eace6fe8dec686e9de14 /users | |
parent | Move actual library code into use_desc_gen.py and make use_desc_gen the drive... (diff) | |
download | gentoo-69d103df4a2c083ca8449fcb5704ffa75007b466.tar.gz gentoo-69d103df4a2c083ca8449fcb5704ffa75007b466.tar.bz2 gentoo-69d103df4a2c083ca8449fcb5704ffa75007b466.zip |
Minor bugfixes; strip out \n and \t. Missing imports.
Diffstat (limited to 'users')
-rw-r--r-- | users/antarus/projects/infra/use_desc_gen | 1 | ||||
-rw-r--r-- | users/antarus/projects/infra/use_desc_gen.py | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/users/antarus/projects/infra/use_desc_gen b/users/antarus/projects/infra/use_desc_gen index 2ee39f6a38..fd202e01da 100644 --- a/users/antarus/projects/infra/use_desc_gen +++ b/users/antarus/projects/infra/use_desc_gen @@ -4,6 +4,7 @@ """A simple driver file for use_desc_gen.""" +import logging import optparse import use_desc_gen diff --git a/users/antarus/projects/infra/use_desc_gen.py b/users/antarus/projects/infra/use_desc_gen.py index b7fe1eb081..a4a1b23fc5 100644 --- a/users/antarus/projects/infra/use_desc_gen.py +++ b/users/antarus/projects/infra/use_desc_gen.py @@ -13,9 +13,6 @@ It is a non-goal of this script to validate XML contents. CAVEATS: TEXT, <pkg>, <pkg>, TEXT. is difficult to parse into text and requires icky rules; see _GetTextFromNode for the nasty details. - -TODO(antarus): Some XML entries have weird blobs of whitespace that strip() does -not want to remove. """ __author__ = "Alec Warner <antarus@gentoo.org>" @@ -82,11 +79,17 @@ def _GetTextFromNode(node): no children are 'raw text' nodes that do not need spaces. Nodes that have children are 'complex' nodes (often <pkg> nodes) that usually require a trailing space to ensure sane output. + + Strip out \n and \t as they are not valid in use.local.desc. """ if node.nodeValue: children = 0 - return (node.nodeValue.strip(), children) + data = node.nodeValue + + data = data.replace("\t", '') + data = data.replace("\n", '') + return (data.strip(), children) else: desc = '' base_children = 1 |