1 |
Author: grobian |
2 |
Date: 2008-05-25 17:54:21 +0000 (Sun, 25 May 2008) |
3 |
New Revision: 10418 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/pym/_emerge/__init__.py |
7 |
main/branches/prefix/pym/portage/__init__.py |
8 |
main/branches/prefix/pym/portage/dbapi/porttree.py |
9 |
main/branches/prefix/pym/portage/dep.py |
10 |
main/branches/prefix/pym/portage/sets/base.py |
11 |
main/branches/prefix/pym/portage/tests/__init__.py |
12 |
main/branches/prefix/pym/portage/tests/dep/test_dep_getusedeps.py |
13 |
main/branches/prefix/pym/portage/tests/dep/test_isvalidatom.py |
14 |
main/branches/prefix/pym/portage/versions.py |
15 |
Log: |
16 |
Merged from trunk 10393:10415 |
17 |
|
18 |
| 10394 | For dep_expand() backward compatibility, handle atoms with | |
19 |
| zmedico | missing '=' prefix which did not raise an error here before | |
20 |
| | the portage.dep.Atom class was introduced. | |
21 |
|
22 |
| 10395 | Fix broken dep_getusedeps() cache behavior so that it | |
23 |
| zmedico | returns the correct type. | |
24 |
|
25 |
| 10396 | Add support for conditionals inside USE dependencies. This | |
26 |
| zmedico | is useful for cases in which the package satisfying a | |
27 |
| | dependency should have identical or opposite flag state | |
28 |
| | relative to the parent package. Conditionals are evaluated | |
29 |
| | as follows: parent state conditional result x [x?] [x] -x | |
30 |
| | [x?] [-x] x [-x?] [-x] -x [-x?] [x] | |
31 |
|
32 |
| 10398 | * Fix dep_getusedeps() test to work with tuples. * Add test | |
33 |
| zmedico | cases for conditional USE deps. | |
34 |
|
35 |
| 10399 | Fix isvalidatom() so tests pass, and add a USE deps case to | |
36 |
| zmedico | the tests. | |
37 |
|
38 |
| 10400 | Remove category validation cruft from catpkgsplit(). | |
39 |
| zmedico | | |
40 |
|
41 |
| 10410 | Remove redundant SLOT dep code in portdbapi.xmatch() since | |
42 |
| zmedico | it's now handled by dbapi._iter_match(). | |
43 |
|
44 |
| 10413 | Facilitate creation of Atom instances in a few obvious | |
45 |
| zmedico | places: * PackageSet._setAtoms() * AtomArg and PackageArg | |
46 |
| | constructors. | |
47 |
|
48 |
| 10415 | * Fix PackageSet.findAtomForPackage() to take a Package | |
49 |
| zmedico | instance as an argument. * Simplify | |
50 |
| | PackageSet.findAtomForPackage() by implementing it on top of | |
51 |
| | iterAtomsForPackage(). | |
52 |
|
53 |
|
54 |
Modified: main/branches/prefix/pym/_emerge/__init__.py |
55 |
=================================================================== |
56 |
--- main/branches/prefix/pym/_emerge/__init__.py 2008-05-25 17:51:33 UTC (rev 10417) |
57 |
+++ main/branches/prefix/pym/_emerge/__init__.py 2008-05-25 17:54:21 UTC (rev 10418) |
58 |
@@ -756,7 +756,8 @@ |
59 |
in world since system atoms can only match one slot while world atoms can |
60 |
be greedy with respect to slots. Unslotted system packages will not be |
61 |
stored in world.""" |
62 |
- arg_atom = args_set.findAtomForPackage(pkg_key, metadata) |
63 |
+ pkg = Package(cpv=pkg_key, metadata=metadata) |
64 |
+ arg_atom = args_set.findAtomForPackage(pkg) |
65 |
if not arg_atom: |
66 |
return None |
67 |
cp = portage.dep_getkey(arg_atom) |
68 |
@@ -812,13 +813,13 @@ |
69 |
if len(matched_slots) == 1: |
70 |
new_world_atom = slot_atom |
71 |
|
72 |
- if new_world_atom == sets["world"].findAtomForPackage(pkg_key, metadata): |
73 |
+ if new_world_atom == sets["world"].findAtomForPackage(pkg): |
74 |
# Both atoms would be identical, so there's nothing to add. |
75 |
return None |
76 |
if not slotted: |
77 |
# Unlike world atoms, system atoms are not greedy for slots, so they |
78 |
# can't be safely excluded from world if they are slotted. |
79 |
- system_atom = sets["system"].findAtomForPackage(pkg_key, metadata) |
80 |
+ system_atom = sets["system"].findAtomForPackage(pkg) |
81 |
if system_atom: |
82 |
if not portage.dep_getkey(system_atom).startswith("virtual/"): |
83 |
return None |
84 |
@@ -1360,13 +1361,15 @@ |
85 |
def __init__(self, atom=None, **kwargs): |
86 |
DependencyArg.__init__(self, **kwargs) |
87 |
self.atom = atom |
88 |
+ if not isinstance(self.atom, portage.dep.Atom): |
89 |
+ self.atom = portage.dep.Atom(self.atom) |
90 |
self.set = (self.atom, ) |
91 |
|
92 |
class PackageArg(DependencyArg): |
93 |
def __init__(self, package=None, **kwargs): |
94 |
DependencyArg.__init__(self, **kwargs) |
95 |
self.package = package |
96 |
- self.atom = "=" + package.cpv |
97 |
+ self.atom = portage.dep.Atom("=" + package.cpv) |
98 |
self.set = (self.atom, ) |
99 |
|
100 |
class SetArg(DependencyArg): |
101 |
@@ -4822,11 +4825,11 @@ |
102 |
pkg_system = False |
103 |
pkg_world = False |
104 |
try: |
105 |
- pkg_system = system_set.findAtomForPackage(pkg_key, metadata) |
106 |
- pkg_world = world_set.findAtomForPackage(pkg_key, metadata) |
107 |
+ pkg_system = system_set.findAtomForPackage(pkg) |
108 |
+ pkg_world = world_set.findAtomForPackage(pkg) |
109 |
if not (oneshot or pkg_world) and \ |
110 |
myroot == self.target_root and \ |
111 |
- favorites_set.findAtomForPackage(pkg_key, metadata): |
112 |
+ favorites_set.findAtomForPackage(pkg): |
113 |
# Maybe it will be added to world now. |
114 |
if create_world_atom(pkg_key, metadata, |
115 |
favorites_set, root_config): |
116 |
@@ -5882,7 +5885,7 @@ |
117 |
#buildsyspkg: Check if we need to _force_ binary package creation |
118 |
issyspkg = ("buildsyspkg" in myfeat) \ |
119 |
and x[0] != "blocks" \ |
120 |
- and system_set.findAtomForPackage(pkg_key, metadata) \ |
121 |
+ and system_set.findAtomForPackage(pkg) \ |
122 |
and "--buildpkg" not in self.myopts |
123 |
if x[0] in ["ebuild","blocks"]: |
124 |
if x[0] == "blocks" and "--fetchonly" not in self.myopts: |
125 |
@@ -6087,7 +6090,7 @@ |
126 |
#need to check for errors |
127 |
if not buildpkgonly: |
128 |
if not (fetchonly or oneshot or pretend) and \ |
129 |
- args_set.findAtomForPackage(pkg_key, metadata): |
130 |
+ args_set.findAtomForPackage(pkg): |
131 |
world_set.lock() |
132 |
world_set.load() # maybe it's changed on disk |
133 |
myfavkey = create_world_atom(pkg_key, metadata, |
134 |
@@ -7952,11 +7955,10 @@ |
135 |
# to remove those. |
136 |
filtered_pkgs = [] |
137 |
for pkg in pkgs: |
138 |
- metadata = dict(izip(metadata_keys, |
139 |
- vardb.aux_get(pkg, metadata_keys))) |
140 |
arg_atom = None |
141 |
try: |
142 |
- arg_atom = args_set.findAtomForPackage(pkg, metadata) |
143 |
+ arg_atom = args_set.findAtomForPackage( |
144 |
+ pkg_cache[("installed", myroot, pkg, "nomerge")]) |
145 |
except portage.exception.InvalidDependString, e: |
146 |
file_path = os.path.join( |
147 |
myroot, portage.VDB_PATH, pkg, "PROVIDE") |
148 |
@@ -8065,11 +8067,10 @@ |
149 |
if action == "depclean": |
150 |
if myfiles: |
151 |
for pkg in vardb.cpv_all(): |
152 |
- metadata = dict(izip(metadata_keys, |
153 |
- vardb.aux_get(pkg, metadata_keys))) |
154 |
arg_atom = None |
155 |
try: |
156 |
- arg_atom = args_set.findAtomForPackage(pkg, metadata) |
157 |
+ arg_atom = args_set.findAtomForPackage( |
158 |
+ pkg_cache[("installed", myroot, pkg, "nomerge")]) |
159 |
except portage.exception.InvalidDependString: |
160 |
# this error has already been displayed by now |
161 |
continue |
162 |
|
163 |
Modified: main/branches/prefix/pym/portage/__init__.py |
164 |
=================================================================== |
165 |
--- main/branches/prefix/pym/portage/__init__.py 2008-05-25 17:51:33 UTC (rev 10417) |
166 |
+++ main/branches/prefix/pym/portage/__init__.py 2008-05-25 17:54:21 UTC (rev 10418) |
167 |
@@ -5451,6 +5451,7 @@ |
168 |
if kwargs["use_binaries"]: |
169 |
portdb = trees[myroot]["bintree"].dbapi |
170 |
myvirtuals = mysettings.getvirtuals() |
171 |
+ myuse = kwargs["myuse"] |
172 |
for x in mysplit: |
173 |
if x == "||": |
174 |
newsplit.append(x) |
175 |
@@ -5459,10 +5460,23 @@ |
176 |
newsplit.append(_expand_new_virtuals(x, edebug, mydbapi, |
177 |
mysettings, myroot=myroot, trees=trees, **kwargs)) |
178 |
continue |
179 |
- if portage.dep._dep_check_strict and \ |
180 |
- not isvalidatom(x, allow_blockers=True): |
181 |
- raise portage.exception.ParseError( |
182 |
- "invalid atom: '%s'" % x) |
183 |
+ |
184 |
+ if not isinstance(x, portage.dep.Atom): |
185 |
+ try: |
186 |
+ x = portage.dep.Atom(x) |
187 |
+ except portage.exception.InvalidAtom: |
188 |
+ if portage.dep._dep_check_strict: |
189 |
+ raise portage.exception.ParseError( |
190 |
+ "invalid atom: '%s'" % x) |
191 |
+ |
192 |
+ if isinstance(x, portage.dep.Atom) and x.use: |
193 |
+ if x.use.conditional: |
194 |
+ evaluated_atom = portage.dep.remove_slot(x) |
195 |
+ if x.slot: |
196 |
+ evaluated_atom += ":%s" % x.slot |
197 |
+ evaluated_atom += str(x.use.evaluate_conditionals(myuse)) |
198 |
+ x = portage.dep.Atom(evaluated_atom) |
199 |
+ |
200 |
mykey = dep_getkey(x) |
201 |
if not mykey.startswith("virtual/"): |
202 |
newsplit.append(x) |
203 |
@@ -5768,8 +5782,15 @@ |
204 |
myindex = orig_dep.index(mydep) |
205 |
prefix = orig_dep[:myindex] |
206 |
postfix = orig_dep[myindex+len(mydep):] |
207 |
- return portage.dep.Atom(prefix + cpv_expand( |
208 |
- mydep, mydb=mydb, use_cache=use_cache, settings=settings) + postfix) |
209 |
+ expanded = cpv_expand(mydep, mydb=mydb, |
210 |
+ use_cache=use_cache, settings=settings) |
211 |
+ try: |
212 |
+ return portage.dep.Atom(prefix + expanded + postfix) |
213 |
+ except portage.exception.InvalidAtom: |
214 |
+ # Missing '=' prefix is allowed for backward compatibility. |
215 |
+ if not isvalidatom("=" + prefix + expanded + postfix): |
216 |
+ raise |
217 |
+ return portage.dep.Atom("=" + prefix + expanded + postfix) |
218 |
|
219 |
def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, |
220 |
use_cache=1, use_binaries=0, myroot="/", trees=None): |
221 |
|
222 |
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py |
223 |
=================================================================== |
224 |
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2008-05-25 17:51:33 UTC (rev 10417) |
225 |
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2008-05-25 17:54:21 UTC (rev 10418) |
226 |
@@ -607,7 +607,6 @@ |
227 |
mydep = dep_expand(origdep, mydb=self, settings=self.mysettings) |
228 |
mykey = dep_getkey(mydep) |
229 |
|
230 |
- myslot = dep_getslot(mydep) |
231 |
if level == "list-visible": |
232 |
#a list of all visible packages, not called directly (just by xmatch()) |
233 |
#myval = self.visible(self.cp_list(mykey)) |
234 |
@@ -650,7 +649,7 @@ |
235 |
continue |
236 |
if not eapi_is_supported(metadata["EAPI"]): |
237 |
continue |
238 |
- if myslot and myslot != metadata["SLOT"]: |
239 |
+ if mydep.slot and mydep.slot != metadata["SLOT"]: |
240 |
continue |
241 |
if settings.getMissingKeywords(cpv, metadata): |
242 |
continue |
243 |
@@ -700,15 +699,7 @@ |
244 |
else: |
245 |
print "ERROR: xmatch doesn't handle", level, "query!" |
246 |
raise KeyError |
247 |
- if myslot is not None and isinstance(myval, list): |
248 |
- slotmatches = [] |
249 |
- for cpv in myval: |
250 |
- try: |
251 |
- if self.aux_get(cpv, ["SLOT"])[0] == myslot: |
252 |
- slotmatches.append(cpv) |
253 |
- except KeyError: |
254 |
- pass # ebuild masked by corruption |
255 |
- myval = slotmatches |
256 |
+ |
257 |
if self.frozen and (level not in ["match-list", "bestmatch-list"]): |
258 |
self.xcache[level][mydep] = myval |
259 |
if origdep and origdep != mydep: |
260 |
|
261 |
Modified: main/branches/prefix/pym/portage/dep.py |
262 |
=================================================================== |
263 |
--- main/branches/prefix/pym/portage/dep.py 2008-05-25 17:51:33 UTC (rev 10417) |
264 |
+++ main/branches/prefix/pym/portage/dep.py 2008-05-25 17:54:21 UTC (rev 10418) |
265 |
@@ -19,6 +19,7 @@ |
266 |
# |
267 |
|
268 |
import re, sys, types |
269 |
+from itertools import chain |
270 |
import portage.exception |
271 |
from portage.exception import InvalidData, InvalidAtom |
272 |
from portage.versions import catpkgsplit, catsplit, pkgcmp, pkgsplit, ververify |
273 |
@@ -340,15 +341,53 @@ |
274 |
def __init__(self, use): |
275 |
enabled_flags = [] |
276 |
disabled_flags = [] |
277 |
+ conditional_enabled = [] |
278 |
+ conditional_disabled = [] |
279 |
for x in use: |
280 |
if "-" == x[:1]: |
281 |
- disabled_flags.append(x[1:]) |
282 |
+ if "?" == x[-1:]: |
283 |
+ conditional_disabled.append(x[1:-1]) |
284 |
+ else: |
285 |
+ disabled_flags.append(x[1:]) |
286 |
else: |
287 |
- enabled_flags.append(x) |
288 |
+ if "?" == x[-1:]: |
289 |
+ conditional_enabled.append(x[:-1]) |
290 |
+ else: |
291 |
+ enabled_flags.append(x) |
292 |
+ self.tokens = use |
293 |
+ if not isinstance(self.tokens, tuple): |
294 |
+ self.tokens = tuple(self.tokens) |
295 |
self.enabled = frozenset(enabled_flags) |
296 |
self.disabled = frozenset(disabled_flags) |
297 |
- self.required = self.enabled.union(self.disabled) |
298 |
+ self.conditional_enabled = frozenset(conditional_enabled) |
299 |
+ self.conditional_disabled = frozenset(conditional_disabled) |
300 |
+ self.conditional = self.conditional_enabled.union( |
301 |
+ self.conditional_disabled) |
302 |
+ self.required = frozenset(chain(self.enabled, self.disabled, |
303 |
+ self.conditional_enabled, self.conditional_disabled)) |
304 |
|
305 |
+ def __str__(self): |
306 |
+ return "".join("[%s]" % x for x in self.tokens) |
307 |
+ |
308 |
+ def evaluate_conditionals(self, use): |
309 |
+ """ |
310 |
+ Create a new instance with conditionals evaluated as follows: |
311 |
+ |
312 |
+ parent state conditional result |
313 |
+ x x? x |
314 |
+ -x x? -x |
315 |
+ x -x? -x |
316 |
+ -x -x? x |
317 |
+ """ |
318 |
+ tokens = [] |
319 |
+ tokens.extend(self.enabled) |
320 |
+ tokens.extend("-" + x for x in self.disabled) |
321 |
+ tokens.extend(self.conditional_enabled.intersection(use)) |
322 |
+ tokens.extend("-" + x for x in self.conditional_enabled.difference(use)) |
323 |
+ tokens.extend("-" + x for x in self.conditional_disabled.intersection(use)) |
324 |
+ tokens.extend(self.conditional_disabled.difference(use)) |
325 |
+ return _use_dep(tokens) |
326 |
+ |
327 |
class Atom(str): |
328 |
|
329 |
def __init__(self, s): |
330 |
@@ -499,8 +538,8 @@ |
331 |
@return: List of use flags ( or [] if no flags exist ) |
332 |
""" |
333 |
use = getattr(depend, "use", None) |
334 |
- if use is not None: |
335 |
- return use |
336 |
+ if use is not None and hasattr(use, "tokens"): |
337 |
+ return use.tokens |
338 |
use_list = [] |
339 |
open_bracket = depend.find('[') |
340 |
# -1 = failure (think c++ string::npos) |
341 |
@@ -518,7 +557,8 @@ |
342 |
open_bracket = depend.find( '[', open_bracket+1 ) |
343 |
return tuple(use_list) |
344 |
|
345 |
-_invalid_atom_chars_regexp = re.compile("[()|?@]") |
346 |
+_valid_category = re.compile("^\w[\w-]*") |
347 |
+_invalid_atom_chars_regexp = re.compile("[()|@]") |
348 |
|
349 |
def isvalidatom(atom, allow_blockers=False): |
350 |
""" |
351 |
@@ -546,10 +586,13 @@ |
352 |
return 0 |
353 |
if allow_blockers and atom.startswith("!"): |
354 |
atom = atom[1:] |
355 |
- try: |
356 |
- mycpv_cps = catpkgsplit(dep_getcpv(atom)) |
357 |
- except InvalidData: |
358 |
- return 0 |
359 |
+ cpv = dep_getcpv(atom) |
360 |
+ if cpv: |
361 |
+ if _valid_category.match(catsplit(cpv)[0]) is None: |
362 |
+ return 0 |
363 |
+ mycpv_cps = catpkgsplit(cpv) |
364 |
+ else: |
365 |
+ mycpv_cps = None |
366 |
operator = get_operator(atom) |
367 |
if operator: |
368 |
if operator[0] in "<>" and remove_slot(atom).endswith("*"): |
369 |
|
370 |
Modified: main/branches/prefix/pym/portage/sets/base.py |
371 |
=================================================================== |
372 |
--- main/branches/prefix/pym/portage/sets/base.py 2008-05-25 17:51:33 UTC (rev 10417) |
373 |
+++ main/branches/prefix/pym/portage/sets/base.py 2008-05-25 17:54:21 UTC (rev 10418) |
374 |
@@ -3,7 +3,7 @@ |
375 |
# $Id$ |
376 |
|
377 |
from portage import cpv_getkey, flatten |
378 |
-from portage.dep import isvalidatom, match_from_list, \ |
379 |
+from portage.dep import Atom, isvalidatom, match_from_list, \ |
380 |
best_match_to_list, dep_getkey, use_reduce, paren_reduce |
381 |
from portage.exception import InvalidAtom |
382 |
|
383 |
@@ -58,15 +58,16 @@ |
384 |
return self._nonatoms.copy() |
385 |
|
386 |
def _setAtoms(self, atoms): |
387 |
- atoms = map(str.strip, atoms) |
388 |
+ self._atoms.clear() |
389 |
self._nonatoms.clear() |
390 |
- for a in atoms[:]: |
391 |
- if a == "": |
392 |
- atoms.remove(a) |
393 |
- elif not isvalidatom(a): |
394 |
- atoms.remove(a) |
395 |
+ for a in atoms: |
396 |
+ a = a.strip() |
397 |
+ if not a: |
398 |
+ continue |
399 |
+ try: |
400 |
+ self._atoms.add(Atom(a)) |
401 |
+ except InvalidAtom: |
402 |
self._nonatoms.add(a) |
403 |
- self._atoms = set(atoms) |
404 |
self._updateAtomMap() |
405 |
|
406 |
def load(self): |
407 |
@@ -99,33 +100,15 @@ |
408 |
self._atommap[cp].add(a) |
409 |
|
410 |
# Not sure if this one should really be in PackageSet |
411 |
- def findAtomForPackage(self, cpv, metadata): |
412 |
+ def findAtomForPackage(self, pkg): |
413 |
"""Return the best match for a given package from the arguments, or |
414 |
None if there are no matches. This matches virtual arguments against |
415 |
the PROVIDE metadata. This can raise an InvalidDependString exception |
416 |
if an error occurs while parsing PROVIDE.""" |
417 |
- cpv_slot = "%s:%s" % (cpv, metadata["SLOT"]) |
418 |
- cp = dep_getkey(cpv) |
419 |
- self._load() # make sure the atoms are loaded |
420 |
- atoms = self._atommap.get(cp) |
421 |
- if atoms: |
422 |
- best_match = best_match_to_list(cpv_slot, atoms) |
423 |
- if best_match: |
424 |
- return best_match |
425 |
- if not metadata["PROVIDE"]: |
426 |
+ atoms = list(self.iterAtomsForPackage(pkg)) |
427 |
+ if not atoms: |
428 |
return None |
429 |
- provides = flatten(use_reduce(paren_reduce(metadata["PROVIDE"]), |
430 |
- uselist=metadata["USE"].split())) |
431 |
- for provide in provides: |
432 |
- provided_cp = dep_getkey(provide) |
433 |
- atoms = self._atommap.get(provided_cp) |
434 |
- if atoms: |
435 |
- atoms = list(atoms) |
436 |
- transformed_atoms = [atom.replace(provided_cp, cp) for atom in atoms] |
437 |
- best_match = best_match_to_list(cpv_slot, transformed_atoms) |
438 |
- if best_match: |
439 |
- return atoms[transformed_atoms.index(best_match)] |
440 |
- return None |
441 |
+ return best_match_to_list(pkg.cpv_slot, atoms) |
442 |
|
443 |
def iterAtomsForPackage(self, pkg): |
444 |
""" |
445 |
|
446 |
Modified: main/branches/prefix/pym/portage/tests/__init__.py |
447 |
=================================================================== |
448 |
--- main/branches/prefix/pym/portage/tests/__init__.py 2008-05-25 17:51:33 UTC (rev 10417) |
449 |
+++ main/branches/prefix/pym/portage/tests/__init__.py 2008-05-25 17:54:21 UTC (rev 10418) |
450 |
@@ -177,4 +177,5 @@ |
451 |
test_cps = ['sys-apps/portage','virtual/portage'] |
452 |
test_versions = ['1.0', '1.0-r1','2.3_p4','1.0_alpha57'] |
453 |
test_slots = [ None, '1','gentoo-sources-2.6.17','spankywashere'] |
454 |
-test_usedeps = ['foo','-bar', ['foo','bar'],['foo','-bar'] ] |
455 |
+test_usedeps = ['foo','-bar', ('foo','bar'), |
456 |
+ ('foo','-bar'), ('foo?', '-bar?') ] |
457 |
|
458 |
Modified: main/branches/prefix/pym/portage/tests/dep/test_dep_getusedeps.py |
459 |
=================================================================== |
460 |
--- main/branches/prefix/pym/portage/tests/dep/test_dep_getusedeps.py 2008-05-25 17:51:33 UTC (rev 10417) |
461 |
+++ main/branches/prefix/pym/portage/tests/dep/test_dep_getusedeps.py 2008-05-25 17:54:21 UTC (rev 10418) |
462 |
@@ -24,7 +24,7 @@ |
463 |
cpv += version |
464 |
if slot: |
465 |
cpv += ":" + slot |
466 |
- if isinstance( use, list ): |
467 |
+ if isinstance(use, tuple): |
468 |
for u in use: |
469 |
cpv = cpv + "[" + u + "]" |
470 |
self.assertEqual( dep_getusedeps( |
471 |
@@ -32,7 +32,7 @@ |
472 |
else: |
473 |
if len(use): |
474 |
self.assertEqual( dep_getusedeps( |
475 |
- cpv + "[" + use + "]" ), [use] ) |
476 |
+ cpv + "[" + use + "]" ), (use,) ) |
477 |
else: |
478 |
self.assertEqual( dep_getusedeps( |
479 |
- cpv + "[" + use + "]" ), [] ) |
480 |
+ cpv + "[" + use + "]" ), () ) |
481 |
|
482 |
Modified: main/branches/prefix/pym/portage/tests/dep/test_isvalidatom.py |
483 |
=================================================================== |
484 |
--- main/branches/prefix/pym/portage/tests/dep/test_isvalidatom.py 2008-05-25 17:51:33 UTC (rev 10417) |
485 |
+++ main/branches/prefix/pym/portage/tests/dep/test_isvalidatom.py 2008-05-25 17:54:21 UTC (rev 10418) |
486 |
@@ -13,8 +13,7 @@ |
487 |
""" |
488 |
|
489 |
def testIsValidAtom(self): |
490 |
- |
491 |
- self.todo = True |
492 |
+ |
493 |
tests = [ ( "sys-apps/portage", True ), |
494 |
( "=sys-apps/portage-2.1", True ), |
495 |
( "=sys-apps/portage-2.1*", True ), |
496 |
@@ -26,9 +25,10 @@ |
497 |
( "sys-apps/portage:foo", True ), |
498 |
( "sys-apps/portage-2.1:foo", False ), |
499 |
( "sys-apps/portage-2.1:", False ), |
500 |
+ ( "=sys-apps/portage-2.2*:foo[bar][-baz][doc?][-build?]", True ), |
501 |
( ">~cate-gory/foo-1.0", False ), |
502 |
- ( ">~category/foo-1.0", True ), |
503 |
- ( "<~category/foo-1.0", True ), |
504 |
+ ( ">~category/foo-1.0", False ), |
505 |
+ ( "<~category/foo-1.0", False ), |
506 |
( "###cat/foo-1.0", False ), |
507 |
( "~sys-apps/portage", False ), |
508 |
( "portage", False ) ] |
509 |
|
510 |
Modified: main/branches/prefix/pym/portage/versions.py |
511 |
=================================================================== |
512 |
--- main/branches/prefix/pym/portage/versions.py 2008-05-25 17:51:33 UTC (rev 10417) |
513 |
+++ main/branches/prefix/pym/portage/versions.py 2008-05-25 17:54:21 UTC (rev 10418) |
514 |
@@ -293,12 +293,8 @@ |
515 |
1. If each exists, it returns [cat, pkgname, version, rev] |
516 |
2. If cat is not specificed in mydata, cat will be "null" |
517 |
3. if rev does not exist it will be '-r0' |
518 |
- 4. If cat is invalid (specified but has incorrect syntax) |
519 |
- an InvalidData Exception will be thrown |
520 |
""" |
521 |
- |
522 |
- # Categories may contain a-zA-z0-9+_- but cannot start with - |
523 |
- import portage.dep |
524 |
+ |
525 |
try: |
526 |
if not catcache[mydata]: |
527 |
return None |
528 |
|
529 |
-- |
530 |
gentoo-commits@l.g.o mailing list |