From 2cc08debc72ad2318a5ce9c42aac962e1eb1491d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 13 Nov 2008 06:49:06 +0000 Subject: [PATCH] Update all portage.sets references to point to the new location, and hardcode the SetConfig constructor with a config for just system and world sets. svn path=/main/branches/2.1.6/; revision=11877 --- bin/emaint | 4 ++-- bin/repoman | 2 +- pym/_emerge/__init__.py | 6 +++--- pym/portage/_sets/__init__.py | 18 +++++++++++++++--- pym/portage/_sets/dbapi.py | 4 ++-- pym/portage/_sets/files.py | 4 ++-- pym/portage/_sets/libs.py | 4 ++-- pym/portage/_sets/profiles.py | 4 ++-- pym/portage/_sets/security.py | 4 ++-- pym/portage/_sets/shell.py | 4 ++-- .../tests/sets/files/testConfigFileSet.py | 2 +- .../tests/sets/files/testStaticFileSet.py | 2 +- pym/portage/tests/sets/shell/testShell.py | 2 +- 13 files changed, 36 insertions(+), 24 deletions(-) diff --git a/bin/emaint b/bin/emaint index 561d26719..054438148 100755 --- a/bin/emaint +++ b/bin/emaint @@ -27,7 +27,7 @@ class WorldHandler(object): self.not_installed = [] self.invalid_category = [] self.okay = [] - from portage.sets import load_default_config + from portage._sets import load_default_config setconfig = load_default_config(portage.settings, portage.db[portage.settings["ROOT"]]) self._sets = setconfig.getSets() @@ -39,7 +39,7 @@ class WorldHandler(object): self.found = os.access(self.world_file, os.R_OK) vardb = portage.db[myroot]["vartree"].dbapi - from portage.sets import SETPREFIX + from portage._sets import SETPREFIX sets = self._sets world_atoms = list(sets["world"]) maxval = len(world_atoms) diff --git a/bin/repoman b/bin/repoman index 22568ab38..a431d293b 100755 --- a/bin/repoman +++ b/bin/repoman @@ -56,7 +56,7 @@ except ImportError: from repoman import utilities from _emerge import Package, RootConfig -from portage.sets import load_default_config +from portage._sets import load_default_config import portage.checksum import portage.const diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 14a63a492..781a7bf01 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -66,8 +66,8 @@ from portage.data import secpass from portage.elog.messages import eerror from portage.util import normalize_path as normpath from portage.util import writemsg, writemsg_level -from portage.sets import load_default_config, SETPREFIX -from portage.sets.base import InternalPackageSet +from portage._sets import load_default_config, SETPREFIX +from portage._sets.base import InternalPackageSet from itertools import chain, izip from UserDict import DictMixin @@ -10739,7 +10739,7 @@ def unmerge(root_config, myopts, unmerge_action, vartree.dbapi.flush_cache() portage.locks.unlockdir(vdb_lock) - from portage.sets.base import EditablePackageSet + from portage._sets.base import EditablePackageSet # generate a list of package sets that are directly or indirectly listed in "world", # as there is no persistent list of "installed" sets diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py index ef7c1d938..36192a083 100644 --- a/pym/portage/_sets/__init__.py +++ b/pym/portage/_sets/__init__.py @@ -29,7 +29,19 @@ class SetConfigError(Exception): class SetConfig(object): def __init__(self, paths, settings, trees): self._parser = SafeConfigParser() - self._parser.read(paths) + #self._parser.read(paths) + # The "paths" argument is ignored and the config for + # system and world sets is hardcoded below. + parser = self._parser + + parser.add_section("system") + parser.set("system", "class", "portage._sets.profiles.PackagesSystemSet") + parser.set("system", "world-candidate", "False") + + parser.add_section("world") + parser.set("world", "class", "portage._sets.files.WorldSet") + parser.set("world", "world-candidate", "False") + self.errors = [] self.psets = {} self.trees = trees @@ -69,7 +81,7 @@ class SetConfig(object): for sname in parser.sections(): # find classname for current section, default to file based sets if not parser.has_option(sname, "class"): - classname = "portage.sets.files.StaticFileSet" + classname = "portage._sets.files.StaticFileSet" else: classname = parser.get(sname, "class") @@ -78,7 +90,7 @@ class SetConfig(object): setclass = load_mod(classname) except (ImportError, AttributeError): try: - setclass = load_mod("portage.sets."+classname) + setclass = load_mod("portage._sets."+classname) except (ImportError, AttributeError): self.errors.append("Could not import '%s' for section '%s'" % (classname, sname)) continue diff --git a/pym/portage/_sets/dbapi.py b/pym/portage/_sets/dbapi.py index 877c45cee..8fc8c2075 100644 --- a/pym/portage/_sets/dbapi.py +++ b/pym/portage/_sets/dbapi.py @@ -4,8 +4,8 @@ from portage.versions import catpkgsplit, catsplit, pkgcmp, best from portage.dep import Atom -from portage.sets.base import PackageSet -from portage.sets import SetConfigError, get_boolean +from portage._sets.base import PackageSet +from portage._sets import SetConfigError, get_boolean __all__ = ["CategorySet", "DowngradeSet", "EverythingSet", "OwnerSet", "VariableSet"] diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py index c9e71a332..b7bb773a0 100644 --- a/pym/portage/_sets/files.py +++ b/pym/portage/_sets/files.py @@ -11,8 +11,8 @@ from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path from portage.const import PRIVATE_PATH, USER_CONFIG_PATH from portage.locks import lockfile, unlockfile from portage import portage_gid -from portage.sets.base import PackageSet, EditablePackageSet -from portage.sets import SetConfigError, SETPREFIX, get_boolean +from portage._sets.base import PackageSet, EditablePackageSet +from portage._sets import SetConfigError, SETPREFIX, get_boolean from portage.env.loaders import ItemFileLoader, KeyListFileLoader from portage.env.validators import ValidAtomValidator from portage import dep_getkey, cpv_getkey diff --git a/pym/portage/_sets/libs.py b/pym/portage/_sets/libs.py index 3722c8462..23d376416 100644 --- a/pym/portage/_sets/libs.py +++ b/pym/portage/_sets/libs.py @@ -2,8 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ -from portage.sets.base import PackageSet -from portage.sets import get_boolean +from portage._sets.base import PackageSet +from portage._sets import get_boolean from portage.versions import catpkgsplit class LibraryConsumerSet(PackageSet): diff --git a/pym/portage/_sets/profiles.py b/pym/portage/_sets/profiles.py index 9c1dcbe86..b95f1f103 100644 --- a/pym/portage/_sets/profiles.py +++ b/pym/portage/_sets/profiles.py @@ -5,8 +5,8 @@ import logging import os from portage.util import grabfile_package, stack_lists -from portage.sets.base import PackageSet -from portage.sets import get_boolean +from portage._sets.base import PackageSet +from portage._sets import get_boolean from portage.util import writemsg_level __all__ = ["PackagesSystemSet"] diff --git a/pym/portage/_sets/security.py b/pym/portage/_sets/security.py index 12503d9a5..a2630fe6f 100644 --- a/pym/portage/_sets/security.py +++ b/pym/portage/_sets/security.py @@ -5,9 +5,9 @@ import os import portage.glsa as glsa from portage.util import grabfile, write_atomic -from portage.sets.base import PackageSet +from portage._sets.base import PackageSet from portage.versions import catpkgsplit, pkgcmp -from portage.sets import get_boolean +from portage._sets import get_boolean __all__ = ["SecuritySet", "NewGlsaSet", "NewAffectedSet", "AffectedSet"] diff --git a/pym/portage/_sets/shell.py b/pym/portage/_sets/shell.py index ba1b2422f..015c51b92 100644 --- a/pym/portage/_sets/shell.py +++ b/pym/portage/_sets/shell.py @@ -5,8 +5,8 @@ import subprocess import os -from portage.sets.base import PackageSet -from portage.sets import SetConfigError +from portage._sets.base import PackageSet +from portage._sets import SetConfigError __all__ = ["CommandOutputSet"] diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py index 7d588fbc3..c8aea5076 100644 --- a/pym/portage/tests/sets/files/testConfigFileSet.py +++ b/pym/portage/tests/sets/files/testConfigFileSet.py @@ -6,7 +6,7 @@ import tempfile, os from portage.tests import TestCase, test_cps -from portage.sets.files import ConfigFileSet +from portage._sets.files import ConfigFileSet class ConfigFileSetTestCase(TestCase): """Simple Test Case for ConfigFileSet""" diff --git a/pym/portage/tests/sets/files/testStaticFileSet.py b/pym/portage/tests/sets/files/testStaticFileSet.py index 71c47dc1b..3613bb157 100644 --- a/pym/portage/tests/sets/files/testStaticFileSet.py +++ b/pym/portage/tests/sets/files/testStaticFileSet.py @@ -6,7 +6,7 @@ import tempfile, os from portage.tests import TestCase, test_cps -from portage.sets.files import StaticFileSet +from portage._sets.files import StaticFileSet from portage.env.loaders import TestTextLoader from portage.env.config import ConfigLoaderKlass diff --git a/pym/portage/tests/sets/shell/testShell.py b/pym/portage/tests/sets/shell/testShell.py index 43d69599a..f8982575a 100644 --- a/pym/portage/tests/sets/shell/testShell.py +++ b/pym/portage/tests/sets/shell/testShell.py @@ -5,7 +5,7 @@ from portage.process import find_binary from portage.tests import TestCase, test_cps -from portage.sets.shell import CommandOutputSet +from portage._sets.shell import CommandOutputSet class CommandOutputSetTestCase(TestCase): """Simple Test Case for CommandOutputSet""" -- 2.26.2