Gentoo Archives: gentoo-commits

From: "Paul Varner (fuzzyray)" <fuzzyray@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoolkit r729 - in trunk/gentoolkit: . pym/gentoolkit pym/gentoolkit/equery pym/gentoolkit/test
Date: Wed, 06 Jan 2010 15:54:41
Message-Id: E1NSYDW-0006kO-6C@stork.gentoo.org
1 Author: fuzzyray
2 Date: 2010-01-06 15:54:37 +0000 (Wed, 06 Jan 2010)
3 New Revision: 729
4
5 Modified:
6 trunk/gentoolkit/DEVELOPING
7 trunk/gentoolkit/pym/gentoolkit/atom.py
8 trunk/gentoolkit/pym/gentoolkit/cpv.py
9 trunk/gentoolkit/pym/gentoolkit/dependencies.py
10 trunk/gentoolkit/pym/gentoolkit/equery/depends.py
11 trunk/gentoolkit/pym/gentoolkit/test/test_atom.py
12 Log:
13 Merge genscripts revision 144, contains fixes for Bug 299260
14
15 Modified: trunk/gentoolkit/DEVELOPING
16 ===================================================================
17 --- trunk/gentoolkit/DEVELOPING 2009-12-17 22:08:34 UTC (rev 728)
18 +++ trunk/gentoolkit/DEVELOPING 2010-01-06 15:54:37 UTC (rev 729)
19 @@ -1,5 +1,5 @@
20 Python Code Guidelines
21 ----------------
22 +----------------------
23 These are a few guidelines to stick to when modifying or adding code to
24 Gentoolkit. These guidelines do not apply to pym/gentoolkit/test/*.
25
26 @@ -33,7 +33,7 @@
27 ...
28 )
29
30 -- Max. line length is strictly 80 characters with a tab length of 4 characters.
31 +- Preferred line length is 80 characters with a tab length of 4 characters.
32 - "The preferred way of wrapping long lines is by using Python's implied line
33 continuation inside parentheses, brackets and braces" rather than using '\'
34 (PEP 8).
35 @@ -47,12 +47,12 @@
36 self._descriptions = \
37 [e.text for e in self._xml_tree.findall("longdescription")]
38
39 - BETTER:
40 + OK:
41 self._descriptions = [
42 e.text for e in self._xml_tree.findall("longdescription")
43 ]
44
45 - BEST: (easiest to read and test)
46 + OK: (easiest to read and test)
47 long_descriptions = self._xml_tree.findall("longdescription")
48 self._descriptions = [e.text for e in long_descriptions]
49
50 @@ -153,14 +153,9 @@
51 Other concerns:
52 ---------------
53 - Choose names which are full, clear words (not necessary in small loops).
54 -- It is NEVER necessary to prefix names with "my". Consider:
55 - class FooThinger(object):
56 - def __init__(self, foo):
57 - self.myfoo = foo
58 -
59 - Just use FooThinger.foo or FooThinger.orig_foo; "my"foo tells us nothing.
60 +- It is NEVER necessary to prefix names with "my". It adds no useful
61 + information.
62 - Comment and document in simple, unambiguous and non-repetitive English.
63 - When adding a TODO, FIXME or XXX comment, please date it and add your name so
64 that other devs know who to ask about the proposed change.
65 -- Be careful of spelling. DO spell check your source code and be professional
66 - when writing comments.
67 +- Be careful of spelling.
68
69 Modified: trunk/gentoolkit/pym/gentoolkit/atom.py
70 ===================================================================
71 --- trunk/gentoolkit/pym/gentoolkit/atom.py 2009-12-17 22:08:34 UTC (rev 728)
72 +++ trunk/gentoolkit/pym/gentoolkit/atom.py 2010-01-06 15:54:37 UTC (rev 729)
73 @@ -68,15 +68,8 @@
74
75 # Make operator compatible with intersects
76 if self.operator is None:
77 - self.operator = '='
78 + self.operator = ''
79
80 - # Make slot a tuple if defined
81 - # pylint screwup:
82 - # E1101: 75:Atom.__init__: Instance of 'tuple' has no 'split' member
83 - # pylint: disable-msg=E1101
84 - if self.slot is not None:
85 - self.slot = tuple(sorted(self.slot.split(',')))
86 -
87 self.cpv = CPV(self.cpv)
88
89 # use_conditional is USE flag condition for this Atom to be required:
90
91 Modified: trunk/gentoolkit/pym/gentoolkit/cpv.py
92 ===================================================================
93 --- trunk/gentoolkit/pym/gentoolkit/cpv.py 2009-12-17 22:08:34 UTC (rev 728)
94 +++ trunk/gentoolkit/pym/gentoolkit/cpv.py 2010-01-06 15:54:37 UTC (rev 729)
95 @@ -36,11 +36,10 @@
96 'sys-apps/portage-2.2-r1'
97 >>> # An 'rc' (release candidate) version is less than non 'rc' version:
98 ... CPV('sys-apps/portage-2') > CPV('sys-apps/portage-2_rc10')
99 + True
100 """
101
102 def __init__(self, cpv):
103 - if not cpv:
104 - raise errors.GentoolkitInvalidCPV(cpv)
105 self.scpv = cpv
106
107 values = split_cpv(cpv)
108 @@ -131,6 +130,7 @@
109
110 Inlined from helpers because of circular imports.
111
112 + @todo: this function is slow and accepts some crazy things for cpv
113 @type cpv: str
114 @param cpv: pkg, cat/pkg, pkg-ver, cat/pkg-ver, atom or regex
115 @rtype: tuple
116
117 Modified: trunk/gentoolkit/pym/gentoolkit/dependencies.py
118 ===================================================================
119 --- trunk/gentoolkit/pym/gentoolkit/dependencies.py 2009-12-17 22:08:34 UTC (rev 728)
120 +++ trunk/gentoolkit/pym/gentoolkit/dependencies.py 2010-01-06 15:54:37 UTC (rev 729)
121 @@ -303,9 +303,13 @@
122 use_conditional = tok[:-1]
123 continue
124 if isinstance(tok, list):
125 - asdf = self._parser(tok, use_conditional, depth=depth+1)
126 - result.extend(asdf)
127 + sub_r = self._parser(tok, use_conditional, depth=depth+1)
128 + result.extend(sub_r)
129 + use_conditional = None
130 continue
131 + if tok[0] == '!':
132 + # We're not interested in blockers
133 + continue
134 atom = Atom(tok)
135 if use_conditional is not None:
136 atom.use_conditional = use_conditional
137
138 Modified: trunk/gentoolkit/pym/gentoolkit/equery/depends.py
139 ===================================================================
140 --- trunk/gentoolkit/pym/gentoolkit/equery/depends.py 2009-12-17 22:08:34 UTC (rev 728)
141 +++ trunk/gentoolkit/pym/gentoolkit/equery/depends.py 2010-01-06 15:54:37 UTC (rev 729)
142 @@ -81,7 +81,7 @@
143 else:
144 formatted_dep = mdep.operator + str(mdep.cpv)
145 if mdep.slot:
146 - formatted_dep += pp.emph(':') + pp.slot(','.join(mdep.slot))
147 + formatted_dep += pp.emph(':') + pp.slot(mdep.slot)
148 if mdep.use:
149 useflags = pp.useflag(','.join(mdep.use.tokens))
150 formatted_dep += (pp.emph('[') + useflags + pp.emph(']'))
151
152 Modified: trunk/gentoolkit/pym/gentoolkit/test/test_atom.py
153 ===================================================================
154 --- trunk/gentoolkit/pym/gentoolkit/test/test_atom.py 2009-12-17 22:08:34 UTC (rev 728)
155 +++ trunk/gentoolkit/pym/gentoolkit/test/test_atom.py 2010-01-06 15:54:37 UTC (rev 729)
156 @@ -71,8 +71,8 @@
157 # slots.
158 self.assertNotEqual2(Atom('cat/pkg:1'), Atom('cat/pkg'))
159 self.assertEqual2(Atom('cat/pkg:2'), Atom('cat/pkg:2'))
160 - self.assertEqual2(Atom('cat/pkg:2,1'), Atom('cat/pkg:2,1'))
161 - self.assertEqual2(Atom('cat/pkg:2,1'), Atom('cat/pkg:1,2'))
162 + # http://dev.gentoo.org/~tanderson/pms/eapi-2-approved/pms.html#x1-190002.1.2
163 + self.assertEqual2(Atom('cat/pkg:AZaz09+_.-'), Atom('cat/pkg:AZaz09+_.-'))
164 for lesser, greater in (('0.1', '1'), ('1', '1-r1'), ('1.1', '1.2')):
165 self.assertTrue(Atom('=d/b-%s' % lesser) <
166 Atom('=d/b-%s' % greater),
167 @@ -126,8 +126,9 @@
168 ('=cat/pkg-1-r1*', '<cat/pkg-1-r1', False),
169 ('=cat/pkg-1*', '>cat/pkg-2', False),
170 ('>=cat/pkg-8.4', '=cat/pkg-8.3.4*', False),
171 - ('cat/pkg::gentoo', 'cat/pkg', True),
172 - ('cat/pkg::gentoo', 'cat/pkg::foo', False),
173 + # Repos not yet supported by Portage
174 + #('cat/pkg::gentoo', 'cat/pkg', True),
175 + #('cat/pkg::gentoo', 'cat/pkg::foo', False),
176 ('=sys-devel/gcc-4.1.1-r3', '=sys-devel/gcc-3.3*', False),
177 ('=sys-libs/db-4*', '~sys-libs/db-4.3.29', True),
178 ]: