aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-24 10:54:48 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-24 10:54:48 -0700
commite45a3f15379d8de4a772e1c70eee51c3d0e358a5 (patch)
tree2a77e5210448a738faa9cb8c81cd67a7387b39ac /pym/portage/dbapi/bintree.py
parenttest_global_updates: test move with operator (diff)
downloadportage-e45a3f15379d8de4a772e1c70eee51c3d0e358a5.tar.gz
portage-e45a3f15379d8de4a772e1c70eee51c3d0e358a5.tar.bz2
portage-e45a3f15379d8de4a772e1c70eee51c3d0e358a5.zip
deprecate "root" attributes
In preparation for prefix support, were EROOT will be used in place of ROOT in many places, deprecate unnecessary "root" attributes in order to eliminate them as a possible source of confusion.
Diffstat (limited to 'pym/portage/dbapi/bintree.py')
-rw-r--r--pym/portage/dbapi/bintree.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 5c091bd45..39bb030f9 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -41,6 +41,7 @@ import subprocess
import sys
import tempfile
import textwrap
+import warnings
from itertools import chain
try:
from urllib.parse import urlparse
@@ -242,10 +243,22 @@ def _pkgindex_cpv_map_latest_build(pkgindex):
class binarytree(object):
"this tree scans for a list of all packages available in PKGDIR"
- def __init__(self, root, pkgdir, virtual=None, settings=None):
+ def __init__(self, _unused=None, pkgdir=None, virtual=None, settings=None):
+
+ if pkgdir is None:
+ raise TypeError("pkgdir parameter is required")
+
+ if settings is None:
+ raise TypeError("settings parameter is required")
+
+ if _unused is not None and _unused != settings['ROOT']:
+ warnings.warn("The root parameter of the "
+ "portage.dbapi.bintree.binarytree"
+ " constructor is now unused. Use "
+ "settings['ROOT'] instead.",
+ DeprecationWarning, stacklevel=2)
+
if True:
- self.root = root
- #self.pkgdir=settings["PKGDIR"]
self.pkgdir = normalize_path(pkgdir)
self.dbapi = bindbapi(self, settings=settings)
self.update_ents = self.dbapi.update_ents
@@ -330,6 +343,15 @@ class binarytree(object):
chain(*self._pkgindex_translated_keys)
))
+ @property
+ def root(self):
+ warnings.warn("The root attribute of "
+ "portage.dbapi.bintree.binarytree"
+ " is deprecated. Use "
+ "settings['ROOT'] instead.",
+ DeprecationWarning, stacklevel=2)
+ return self.settings['ROOT']
+
def move_ent(self, mylist, repo_match=None):
if not self.populated:
self.populate()