Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/metadata/
Date: Tue, 26 Jun 2012 15:43:40
Message-Id: 1340725126.b0739582a711f64395226e8c33a4a3a6b9b66298.dywi@gentoo
1 commit: b0739582a711f64395226e8c33a4a3a6b9b66298
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Tue Jun 26 15:38:46 2012 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Tue Jun 26 15:38:46 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=b0739582
7
8 fix metadata creation
9
10 * replaces yesterday's workaround
11
12 modified: roverlay/metadata/__init__.py
13 modified: roverlay/metadata/nodes.py
14
15 ---
16 roverlay/metadata/__init__.py | 37 ++++++++++++++++++++-----------------
17 roverlay/metadata/nodes.py | 10 ++++------
18 2 files changed, 24 insertions(+), 23 deletions(-)
19
20 diff --git a/roverlay/metadata/__init__.py b/roverlay/metadata/__init__.py
21 index 3385119..13fc169 100644
22 --- a/roverlay/metadata/__init__.py
23 +++ b/roverlay/metadata/__init__.py
24 @@ -6,6 +6,8 @@ import roverlay.config
25
26 from roverlay.metadata import nodes
27
28 +USE_FULL_DESCRIPTION = True
29 +
30 class MetadataJob ( object ):
31 """R package description data -> metadata.xml interface."""
32
33 @@ -34,28 +36,29 @@ class MetadataJob ( object ):
34
35 returns: None (implicit)
36 """
37 - desc_data = package_info ['desc_data']
38 + data = package_info ['desc_data']
39
40 mref = self._metadata
41
42 max_textline_width = roverlay.config.get ( 'METADATA.linewidth', 65 )
43
44 - # FIXME/TODO remove long/not long bool from DescriptionNode!
45 -
46 - if 'Description' in desc_data:
47 - # !passing have_desc for DescriptionNode's is_long parameter redirects
48 - # !the second description info into <longdescription.../>
49 - mref.add ( nodes.DescriptionNode (
50 - desc_data ['Description'],
51 - is_long=True,
52 - linewidth=max_textline_width
53 - ) )
54 - elif 'Title' in desc_data:
55 - mref.add ( nodes.DescriptionNode (
56 - desc_data ['Title'],
57 - is_long=True,
58 - linewidth=max_textline_width
59 - ) )
60 +
61 + description = None
62 +
63 + if USE_FULL_DESCRIPTION and 'Title' in data and 'Description' in data:
64 + description = data ['Title'] + ' // ' + data ['Description']
65 +
66 + elif 'Description' in data:
67 + description = ddata ['Description']
68 +
69 + elif 'Title' in data:
70 + description = data ['Title']
71 +
72 + #if description:
73 + if description is not None:
74 + mref.add (
75 + nodes.DescriptionNode ( description, linewidth=max_textline_width )
76 + )
77
78 # these USE flags are described in profiles/use.desc,
79 # no need to include them here
80
81 diff --git a/roverlay/metadata/nodes.py b/roverlay/metadata/nodes.py
82 index 4d4d5fd..1fba079 100644
83 --- a/roverlay/metadata/nodes.py
84 +++ b/roverlay/metadata/nodes.py
85 @@ -100,25 +100,23 @@ class MetadataRoot ( MetadataNodeNamedAccess ):
86
87
88 class DescriptionNode ( MetadataLeaf ):
89 - """A description (<description.../>, <longdescription.../>) node."""
90 + """A description (<longdescription.../>) node."""
91
92 - def __init__ ( self, description, is_long=False, linewidth=None ):
93 + def __init__ ( self, description, linewidth=None ):
94 """Initializes a DescriptionNode.
95
96 arguments:
97 * description -- description text
98 - * is_long -- if this is a longdescription or a description node
99 * linewidth -- max text line width
100 """
101 super ( DescriptionNode, self ) . __init__ (
102 - 'longdescription' if is_long else 'description',
103 - value=description,
104 + 'longdescription', value=description
105 )
106
107 if not linewidth is None and linewidth > 0:
108 self.linewidth = linewidth
109
110 - self.priority = 150 if is_long else 149
111 + self.priority = 150
112 # --- end of __init__ (...) ---
113
114 # using value formatting