1 |
commit: bbe00f515b80be3d6e279e4033f1cbc776a7fe27 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 20 06:39:39 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 20 06:53:34 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bbe00f51 |
7 |
|
8 |
portagetree: getname and portroot DeprecationWarning |
9 |
|
10 |
Bug: https://bugs.gentoo.org/668164 |
11 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
12 |
|
13 |
lib/portage/dbapi/porttree.py | 16 ++++++++++++++-- |
14 |
1 file changed, 14 insertions(+), 2 deletions(-) |
15 |
|
16 |
diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py |
17 |
index 76b7967f7..2ff3e1b34 100644 |
18 |
--- a/lib/portage/dbapi/porttree.py |
19 |
+++ b/lib/portage/dbapi/porttree.py |
20 |
@@ -1339,10 +1339,18 @@ class portagetree(object): |
21 |
" constructor is unused", |
22 |
DeprecationWarning, stacklevel=2) |
23 |
|
24 |
- self.portroot = settings["PORTDIR"] |
25 |
self.__virtual = virtual |
26 |
self.dbapi = portdbapi(mysettings=settings) |
27 |
|
28 |
+ @property |
29 |
+ def portroot(self): |
30 |
+ """Deprecated. Use the portdbapi getRepositoryPath method instead.""" |
31 |
+ warnings.warn("The portroot attribute of " |
32 |
+ "portage.dbapi.porttree.portagetree is deprecated. Use the " |
33 |
+ "portdbapi getRepositoryPath method instead.", |
34 |
+ DeprecationWarning, stacklevel=3) |
35 |
+ return self.settings['PORTDIR'] |
36 |
+ |
37 |
@property |
38 |
def root(self): |
39 |
warnings.warn("The root attribute of " + \ |
40 |
@@ -1383,7 +1391,11 @@ class portagetree(object): |
41 |
return self.dbapi.cp_all() |
42 |
|
43 |
def getname(self, pkgname): |
44 |
- "returns file location for this particular package (DEPRECATED)" |
45 |
+ """Deprecated. Use the portdbapi findname method instead.""" |
46 |
+ warnings.warn("The getname method of " |
47 |
+ "portage.dbapi.porttree.portagetree is deprecated. " |
48 |
+ "Use the portdbapi findname method instead.", |
49 |
+ DeprecationWarning, stacklevel=2) |
50 |
if not pkgname: |
51 |
return "" |
52 |
mysplit = pkgname.split("/") |