Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/
Date: Sat, 29 Oct 2011 04:17:36
Message-Id: 3cfb2bc711d820fcef376aee170de560d8195819.zmedico@gentoo
1 commit: 3cfb2bc711d820fcef376aee170de560d8195819
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 29 04:17:11 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 29 04:17:11 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3cfb2bc7
7
8 Deprecate unused 'virtual' constructor parameters
9
10 ---
11 pym/portage/dbapi/bintree.py | 9 ++++++++-
12 pym/portage/dbapi/porttree.py | 18 ++++++++++++++++--
13 pym/portage/dbapi/vartree.py | 8 +++++++-
14 3 files changed, 31 insertions(+), 4 deletions(-)
15
16 diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
17 index 0fb8be9..4c24929 100644
18 --- a/pym/portage/dbapi/bintree.py
19 +++ b/pym/portage/dbapi/bintree.py
20 @@ -243,7 +243,8 @@ def _pkgindex_cpv_map_latest_build(pkgindex):
21
22 class binarytree(object):
23 "this tree scans for a list of all packages available in PKGDIR"
24 - def __init__(self, _unused=None, pkgdir=None, virtual=None, settings=None):
25 + def __init__(self, _unused=None, pkgdir=None,
26 + virtual=DeprecationWarning, settings=None):
27
28 if pkgdir is None:
29 raise TypeError("pkgdir parameter is required")
30 @@ -258,6 +259,12 @@ class binarytree(object):
31 "settings['ROOT'] instead.",
32 DeprecationWarning, stacklevel=2)
33
34 + if virtual is not DeprecationWarning:
35 + warnings.warn("The 'virtual' parameter of the "
36 + "portage.dbapi.bintree.binarytree"
37 + " constructor is unused",
38 + DeprecationWarning, stacklevel=2)
39 +
40 if True:
41 self.pkgdir = normalize_path(pkgdir)
42 self.dbapi = bindbapi(self, settings=settings)
43
44 diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
45 index fc7feb3..5c45d97 100644
46 --- a/pym/portage/dbapi/porttree.py
47 +++ b/pym/portage/dbapi/porttree.py
48 @@ -1064,7 +1064,7 @@ def close_portdbapi_caches():
49 portage.process.atexit_register(portage.portageexit)
50
51 class portagetree(object):
52 - def __init__(self, root=None, virtual=None, settings=None):
53 + def __init__(self, root=None, virtual=DeprecationWarning, settings=None):
54 """
55 Constructor for a PortageTree
56
57 @@ -1087,8 +1087,14 @@ class portagetree(object):
58 "settings['ROOT'] instead.",
59 DeprecationWarning, stacklevel=2)
60
61 + if virtual is not DeprecationWarning:
62 + warnings.warn("The 'virtual' parameter of the "
63 + "portage.dbapi.porttree.portagetree"
64 + " constructor is unused",
65 + DeprecationWarning, stacklevel=2)
66 +
67 self.portroot = settings["PORTDIR"]
68 - self.virtual = virtual
69 + self.__virtual = virtual
70 self.dbapi = portdbapi(mysettings=settings)
71
72 @property
73 @@ -1100,6 +1106,14 @@ class portagetree(object):
74 DeprecationWarning, stacklevel=3)
75 return self.settings['ROOT']
76
77 + @property
78 + def virtual(self):
79 + warnings.warn("The 'virtual' attribute of " + \
80 + "portage.dbapi.porttree.portagetree" + \
81 + " is deprecated.",
82 + DeprecationWarning, stacklevel=3)
83 + return self.__virtual
84 +
85 def dep_bestmatch(self,mydep):
86 "compatibility method"
87 mymatch = self.dbapi.xmatch("bestmatch-visible",mydep)
88
89 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
90 index e719062..ee0db6f 100644
91 --- a/pym/portage/dbapi/vartree.py
92 +++ b/pym/portage/dbapi/vartree.py
93 @@ -1163,7 +1163,7 @@ class vardbapi(dbapi):
94
95 class vartree(object):
96 "this tree will scan a var/db/pkg database located at root (passed to init)"
97 - def __init__(self, root=None, virtual=None, categories=None,
98 + def __init__(self, root=None, virtual=DeprecationWarning, categories=None,
99 settings=None):
100
101 if settings is None:
102 @@ -1176,6 +1176,12 @@ class vartree(object):
103 "settings['ROOT'] instead.",
104 DeprecationWarning, stacklevel=2)
105
106 + if virtual is not DeprecationWarning:
107 + warnings.warn("The 'virtual' parameter of the "
108 + "portage.dbapi.vartree.vartree"
109 + " constructor is unused",
110 + DeprecationWarning, stacklevel=2)
111 +
112 self.settings = settings
113 self.dbapi = vardbapi(settings=settings, vartree=self)
114 self.populated = 1