summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-03-26 05:25:01 +0000
committerAlec Warner <antarus@gentoo.org>2007-03-26 05:25:01 +0000
commitd80792f4c02169178cbf0885b19c7948e5648758 (patch)
tree2e9d4ea3f86d17cabb758a537bd2d08619288063
parentf779dc52efb6f2bb57d50193f0ce3f06c284a3fc (diff)
downloadportage-d80792f4c02169178cbf0885b19c7948e5648758.tar.gz
portage-d80792f4c02169178cbf0885b19c7948e5648758.tar.bz2
portage-d80792f4c02169178cbf0885b19c7948e5648758.zip
clean up some init functions, add PortageModules class
svn path=/main/trunk/; revision=6288
-rw-r--r--pym/portage/env/config.py45
1 files changed, 39 insertions, 6 deletions
diff --git a/pym/portage/env/config.py b/pym/portage/env/config.py
index 4af7ac47b..127e906d5 100644
--- a/pym/portage/env/config.py
+++ b/pym/portage/env/config.py
@@ -42,8 +42,7 @@ class PackageKeywordsFile(PackageKeywords):
default_loader = KeyListFileLoader
def __init__(self, filename):
- self.loader = self.default_loader(filename)
- PackageKeywords.__init__(self, self.loader)
+ PackageKeywords.__init__(self, self.default_loader(filename))
class PackageUse(UserDict):
"""
@@ -80,8 +79,7 @@ class PackageUseFile(PackageUse):
default_loader = KeyListFileLoader
def __init__(self, filename):
- self.loader = self.default_loader(filename)
- PackageUse.__init__(self, self.loader)
+ PackageUse.__init__(self, self.default_loader(filename))
class PackageMask(UserDict):
"""
@@ -125,5 +123,40 @@ class PackageMaskFile(PackageMask):
default_loader = AtomFileLoader
def __init__(self, filename):
- self.loader = self.default_loader(filename)
- PackageMask.__init__(self, self.loader)
+ PackageMask.__init__(self, self.default_loader(filename))
+
+class PortageModules(UserDict):
+ """
+ Base Class for user level module over-rides
+ """
+
+ def __init__(self, loader):
+ self._loader = loader
+
+ def load(self):
+ self.data, self.errors = self._loader.load()
+
+ def iteritems(self):
+ return self.data.iteritems()
+
+ def __hash__(self):
+ return self.data.__hash__()
+
+ def __contains__(self, key):
+ return key in self.data
+
+ def keys(self):
+ return self.data.keys()
+
+ def iterkeys(self):
+ return self.data.iterkeys()
+
+class PortageModulesFile(PortageModules):
+ """
+ File Class for /etc/portage/modules
+ """
+
+ default_loader = KeyValuePairFileLoader
+
+ def __init__(self, filename):
+ PortageModules.__init__(self, default_loader(filename))