summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Erdmann2012-06-26 15:38:46 (GMT)
committerAndré Erdmann2012-06-26 15:38:46 (GMT)
commitb0739582a711f64395226e8c33a4a3a6b9b66298 (patch)
treed605e395fdc30bba3d96b622038b9e1ec1ad78a3
parent2383f21652384458d0fc7a05a0c70610f22719d3 (diff)
fix metadata creation
* replaces yesterday's workaround modified: roverlay/metadata/__init__.py modified: roverlay/metadata/nodes.py
-rw-r--r--roverlay/metadata/__init__.py37
-rw-r--r--roverlay/metadata/nodes.py10
2 files changed, 24 insertions, 23 deletions
diff --git a/roverlay/metadata/__init__.py b/roverlay/metadata/__init__.py
index 3385119..13fc169 100644
--- a/roverlay/metadata/__init__.py
+++ b/roverlay/metadata/__init__.py
@@ -6,6 +6,8 @@ import roverlay.config
from roverlay.metadata import nodes
+USE_FULL_DESCRIPTION = True
+
class MetadataJob ( object ):
"""R package description data -> metadata.xml interface."""
@@ -34,28 +36,29 @@ class MetadataJob ( object ):
returns: None (implicit)
"""
- desc_data = package_info ['desc_data']
+ data = package_info ['desc_data']
mref = self._metadata
max_textline_width = roverlay.config.get ( 'METADATA.linewidth', 65 )
- # FIXME/TODO remove long/not long bool from DescriptionNode!
-
- if 'Description' in desc_data:
- # !passing have_desc for DescriptionNode's is_long parameter redirects
- # !the second description info into <longdescription.../>
- mref.add ( nodes.DescriptionNode (
- desc_data ['Description'],
- is_long=True,
- linewidth=max_textline_width
- ) )
- elif 'Title' in desc_data:
- mref.add ( nodes.DescriptionNode (
- desc_data ['Title'],
- is_long=True,
- linewidth=max_textline_width
- ) )
+
+ description = None
+
+ if USE_FULL_DESCRIPTION and 'Title' in data and 'Description' in data:
+ description = data ['Title'] + ' // ' + data ['Description']
+
+ elif 'Description' in data:
+ description = ddata ['Description']
+
+ elif 'Title' in data:
+ description = data ['Title']
+
+ #if description:
+ if description is not None:
+ mref.add (
+ nodes.DescriptionNode ( description, linewidth=max_textline_width )
+ )
# these USE flags are described in profiles/use.desc,
# no need to include them here
diff --git a/roverlay/metadata/nodes.py b/roverlay/metadata/nodes.py
index 4d4d5fd..1fba079 100644
--- a/roverlay/metadata/nodes.py
+++ b/roverlay/metadata/nodes.py
@@ -100,25 +100,23 @@ class MetadataRoot ( MetadataNodeNamedAccess ):
class DescriptionNode ( MetadataLeaf ):
- """A description (<description.../>, <longdescription.../>) node."""
+ """A description (<longdescription.../>) node."""
- def __init__ ( self, description, is_long=False, linewidth=None ):
+ def __init__ ( self, description, linewidth=None ):
"""Initializes a DescriptionNode.
arguments:
* description -- description text
- * is_long -- if this is a longdescription or a description node
* linewidth -- max text line width
"""
super ( DescriptionNode, self ) . __init__ (
- 'longdescription' if is_long else 'description',
- value=description,
+ 'longdescription', value=description
)
if not linewidth is None and linewidth > 0:
self.linewidth = linewidth
- self.priority = 150 if is_long else 149
+ self.priority = 150
# --- end of __init__ (...) ---
# using value formatting