summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-02-21 10:01:47 +0000
committerZac Medico <zmedico@gentoo.org>2010-02-21 10:01:47 +0000
commitc2eed833bc66ffe0ee045890f3602136e268096c (patch)
tree00d2961ae1753f1e79741c42efa66ec74aab01b3 /pym
parentf413d2daef93ea5f49222a3071c880b4848aac50 (diff)
downloadportage-c2eed833bc66ffe0ee045890f3602136e268096c.tar.gz
portage-c2eed833bc66ffe0ee045890f3602136e268096c.tar.bz2
portage-c2eed833bc66ffe0ee045890f3602136e268096c.zip
Move the portage.FetchlistDict class to the portage.dbapi.porttree module.
svn path=/main/trunk/; revision=15417
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py39
-rw-r--r--pym/portage/dbapi/porttree.py45
2 files changed, 46 insertions, 38 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 6515b919e..212951102 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -8770,43 +8770,8 @@ from portage.dbapi import dbapi
from portage.dbapi.virtual import fakedbapi
from portage.dbapi.bintree import bindbapi, binarytree
from portage.dbapi.vartree import vardbapi, vartree, dblink
-from portage.dbapi.porttree import close_portdbapi_caches, portdbapi, portagetree
-
-class FetchlistDict(portage.cache.mappings.Mapping):
- """This provide a mapping interface to retrieve fetch lists. It's used
- to allow portage.manifest.Manifest to access fetch lists via a standard
- mapping interface rather than use the dbapi directly."""
- def __init__(self, pkgdir, settings, mydbapi):
- """pkgdir is a directory containing ebuilds and settings is passed into
- portdbapi.getfetchlist for __getitem__ calls."""
- self.pkgdir = pkgdir
- self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
- self.settings = settings
- self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
- self.portdb = mydbapi
- def __getitem__(self, pkg_key):
- """Returns the complete fetch list for a given package."""
- return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
- def __contains__(self, cpv):
- return cpv in self.__iter__()
- def has_key(self, pkg_key):
- """Returns true if the given package exists within pkgdir."""
- return pkg_key in self
-
- def __iter__(self):
- return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
-
- def __len__(self):
- """This needs to be implemented in order to avoid
- infinite recursion in some cases."""
- return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
-
- def keys(self):
- """Returns keys for all packages within pkgdir"""
- return self.portdb.cp_list(self.cp, mytree=self.mytree)
-
- if sys.hexversion >= 0x3000000:
- keys = __iter__
+from portage.dbapi.porttree import FetchlistDict, \
+ close_portdbapi_caches, portagetree, portdbapi
def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None,
vartree=None, prev_mtimes=None, blockers=None):
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 7cae96796..93f3b411b 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -4,7 +4,9 @@
from __future__ import print_function
-__all__ = ["portdbapi", "close_portdbapi_caches", "portagetree"]
+__all__ = [
+ "close_portdbapi_caches", "FetchlistDict", "portagetree", "portdbapi"
+]
import portage
portage.proxy.lazyimport.lazyimport(globals(),
@@ -1240,3 +1242,44 @@ class portagetree(object):
except Exception as e:
pass
return myslot
+
+class FetchlistDict(portage.cache.mappings.Mapping):
+ """
+ This provide a mapping interface to retrieve fetch lists. It's used
+ to allow portage.manifest.Manifest to access fetch lists via a standard
+ mapping interface rather than use the dbapi directly.
+ """
+ def __init__(self, pkgdir, settings, mydbapi):
+ """pkgdir is a directory containing ebuilds and settings is passed into
+ portdbapi.getfetchlist for __getitem__ calls."""
+ self.pkgdir = pkgdir
+ self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
+ self.settings = settings
+ self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
+ self.portdb = mydbapi
+
+ def __getitem__(self, pkg_key):
+ """Returns the complete fetch list for a given package."""
+ return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
+
+ def __contains__(self, cpv):
+ return cpv in self.__iter__()
+
+ def has_key(self, pkg_key):
+ """Returns true if the given package exists within pkgdir."""
+ return pkg_key in self
+
+ def __iter__(self):
+ return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
+
+ def __len__(self):
+ """This needs to be implemented in order to avoid
+ infinite recursion in some cases."""
+ return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
+
+ def keys(self):
+ """Returns keys for all packages within pkgdir"""
+ return self.portdb.cp_list(self.cp, mytree=self.mytree)
+
+ if sys.hexversion >= 0x3000000:
+ keys = __iter__