1 |
commit: 0d375f1105ad67c8b7e3b16b57cdbb367f99cd69 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 23 20:50:45 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 23 20:50:45 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0d375f11 |
7 |
|
8 |
portdbapi.xmatch: deprecate *match-list |
9 |
|
10 |
These don't mesh well with multi-repo support. |
11 |
|
12 |
--- |
13 |
pym/portage/dbapi/porttree.py | 24 +++++++++++++++--------- |
14 |
1 files changed, 15 insertions(+), 9 deletions(-) |
15 |
|
16 |
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py |
17 |
index d42e41e..ac58375 100644 |
18 |
--- a/pym/portage/dbapi/porttree.py |
19 |
+++ b/pym/portage/dbapi/porttree.py |
20 |
@@ -989,23 +989,29 @@ class portdbapi(dbapi): |
21 |
|
22 |
elif level == "bestmatch-list": |
23 |
#dep match -- find best match but restrict search to sublist |
24 |
- #no point in calling xmatch again since we're not caching list deps |
25 |
- |
26 |
+ warnings.warn("The 'bestmatch-list' mode of " |
27 |
+ "portage.dbapi.porttree.portdbapi.xmatch is deprecated", |
28 |
+ DeprecationWarning, stacklevel=2) |
29 |
myval = best(list(self._iter_match(mydep, mylist))) |
30 |
elif level == "match-list": |
31 |
#dep match -- find all matches but restrict search to sublist (used in 2nd half of visible()) |
32 |
- |
33 |
+ warnings.warn("The 'match-list' mode of " |
34 |
+ "portage.dbapi.porttree.portdbapi.xmatch is deprecated", |
35 |
+ DeprecationWarning, stacklevel=2) |
36 |
myval = list(self._iter_match(mydep, mylist)) |
37 |
- |
38 |
else: |
39 |
raise AssertionError( |
40 |
"Invalid level argument: '%s'" % level) |
41 |
|
42 |
- if self.frozen and (level not in ["match-list", "bestmatch-list"]): |
43 |
- self.xcache[level][mydep] = myval |
44 |
- if origdep and origdep != mydep: |
45 |
- self.xcache[level][origdep] = myval |
46 |
- return myval[:] |
47 |
+ if self.frozen: |
48 |
+ xcache_this_level = self.xcache.get(level) |
49 |
+ if xcache_this_level is not None: |
50 |
+ xcache_this_level[mydep] = myval |
51 |
+ if origdep and origdep != mydep: |
52 |
+ xcache_this_level[origdep] = myval |
53 |
+ myval = myval[:] |
54 |
+ |
55 |
+ return myval |
56 |
|
57 |
def match(self, mydep, use_cache=1): |
58 |
return self.xmatch("match-visible", mydep) |