diff options
Diffstat (limited to 'portato/backend/__init__.py')
-rw-r--r-- | portato/backend/__init__.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/portato/backend/__init__.py b/portato/backend/__init__.py index 5ee2e2a..1e7066f 100644 --- a/portato/backend/__init__.py +++ b/portato/backend/__init__.py @@ -3,7 +3,7 @@ # File: portato/backend/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006 René 'Necoro' Neumann +# Copyright (C) 2006-2007 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -17,12 +17,23 @@ from threading import Lock import portage class PortageSettings: + """Encapsulation of the portage settings. + + @ivar settings: portage settings + @ivar settingslock: a simple Lock + @ivar trees: a dictionary of the trees + @ivar porttree: shortcut to C{trees[root]["porttree"]} + @ivar vartree: shortcut to C{trees[root]["vartree"]} + @ivar virtuals: shortcut to C{trees[root]["virtuals"]}""" def __init__ (self): + """Initializes the instance. Calls L{load()}.""" self.settingslock = Lock() self.load() def load(self): + """(Re)loads the portage settings and sets the variables.""" + kwargs = {} for k, envvar in (("config_root", "PORTAGE_CONFIGROOT"), ("target_root", "ROOT")): kwargs[k] = os.environ.get(envvar, None) @@ -42,10 +53,13 @@ class PortageSettings: self.porttree = self.trees[root]["porttree"] self.vartree = self.trees[root]["vartree"] self.virtuals = self.trees[root]["virtuals"] + + portage.settings = None # we use our own one ... # portage tree vars portage_settings = PortageSettings() +# for the moment ;) settingslock = portage_settings.settingslock settings = portage_settings.settings trees = portage_settings.trees @@ -54,8 +68,7 @@ vartree = portage_settings.vartree virtuals = portage_settings.virtuals # this is set to "var/lib/portage/world" by default - so we add the leading / -portage.WORLD_FILE = portage.settings["ROOT"]+portage.WORLD_FILE -portage.settings = None # we use our own one ... +portage.WORLD_FILE = portage_settings.settings["ROOT"]+portage.WORLD_FILE # import our packages from exceptions import * |