From 25d8427b3b29cbcee97279186983dae818495f8f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 30 Aug 2010 00:16:50 -0700 Subject: [PATCH] Rename the portage.sets module to portage._sets since it will be useful in the upcoming 2.1.9 branch which will not have sets support but will still have the code in private and disabled form. --- bin/emaint | 4 ++-- bin/quickpkg | 2 +- bin/regenworld | 2 +- pym/_emerge/BlockerDB.py | 2 +- pym/_emerge/Scheduler.py | 4 ++-- pym/_emerge/SetArg.py | 2 +- pym/_emerge/actions.py | 4 ++-- pym/_emerge/depgraph.py | 4 ++-- pym/_emerge/main.py | 8 ++++---- pym/_emerge/resolver/slot_collision.py | 2 +- pym/_emerge/unmerge.py | 4 ++-- pym/portage/{sets => _sets}/__init__.py | 11 ++++++++--- pym/portage/{sets => _sets}/base.py | 0 pym/portage/{sets => _sets}/dbapi.py | 4 ++-- pym/portage/{sets => _sets}/files.py | 4 ++-- pym/portage/{sets => _sets}/libs.py | 4 ++-- pym/portage/{sets => _sets}/profiles.py | 4 ++-- pym/portage/{sets => _sets}/security.py | 4 ++-- pym/portage/{sets => _sets}/shell.py | 4 ++-- pym/portage/tests/resolver/ResolverPlayground.py | 2 +- pym/portage/tests/sets/base/testInternalPackageSet.py | 2 +- pym/portage/tests/sets/files/testConfigFileSet.py | 2 +- pym/portage/tests/sets/files/testStaticFileSet.py | 2 +- pym/portage/tests/sets/shell/testShell.py | 2 +- 24 files changed, 44 insertions(+), 39 deletions(-) rename pym/portage/{sets => _sets}/__init__.py (95%) rename pym/portage/{sets => _sets}/base.py (100%) rename pym/portage/{sets => _sets}/dbapi.py (99%) rename pym/portage/{sets => _sets}/files.py (98%) rename pym/portage/{sets => _sets}/libs.py (97%) rename pym/portage/{sets => _sets}/profiles.py (95%) rename pym/portage/{sets => _sets}/security.py (97%) rename pym/portage/{sets => _sets}/shell.py (93%) diff --git a/bin/emaint b/bin/emaint index 6a73c6fe2..5ff60422c 100755 --- a/bin/emaint +++ b/bin/emaint @@ -32,7 +32,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() @@ -44,7 +44,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["selected"]) maxval = len(world_atoms) diff --git a/bin/quickpkg b/bin/quickpkg index 042e98cc2..3e971f5d7 100755 --- a/bin/quickpkg +++ b/bin/quickpkg @@ -26,7 +26,7 @@ from portage.exception import InvalidAtom, InvalidData, InvalidDependString, Pac from portage.util import ConfigProtect, ensure_dirs, shlex_split from portage.dbapi.vartree import dblink, tar_contents from portage.checksum import perform_md5 -from portage.sets import load_default_config, SETPREFIX +from portage._sets import load_default_config, SETPREFIX def quickpkg_atom(options, infos, arg, eout): settings = portage.settings diff --git a/bin/regenworld b/bin/regenworld index c3e7f4470..292eac1ac 100755 --- a/bin/regenworld +++ b/bin/regenworld @@ -13,7 +13,7 @@ except ImportError: import portage from portage import os -from portage.sets.files import StaticFileSet, WorldSelectedSet +from portage._sets.files import StaticFileSet, WorldSelectedSet import re import tempfile diff --git a/pym/_emerge/BlockerDB.py b/pym/_emerge/BlockerDB.py index 8b2a22d8e..f671a58a7 100644 --- a/pym/_emerge/BlockerDB.py +++ b/pym/_emerge/BlockerDB.py @@ -6,7 +6,7 @@ import sys import portage from portage import os from portage import digraph -from portage.sets.base import InternalPackageSet +from portage._sets.base import InternalPackageSet from _emerge.BlockerCache import BlockerCache from _emerge.FakeVartree import FakeVartree diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 7db16088d..ee5b8a3d5 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -24,8 +24,8 @@ from portage.elog.messages import eerror from portage.localization import _ from portage.output import colorize, create_color_func, red bad = create_color_func("BAD") -from portage.sets import SETPREFIX -from portage.sets.base import InternalPackageSet +from portage._sets import SETPREFIX +from portage._sets.base import InternalPackageSet from portage.util import writemsg, writemsg_level from portage.package.ebuild.digestcheck import digestcheck from portage.package.ebuild.digestgen import digestgen diff --git a/pym/_emerge/SetArg.py b/pym/_emerge/SetArg.py index e43ad5812..2941695a8 100644 --- a/pym/_emerge/SetArg.py +++ b/pym/_emerge/SetArg.py @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 from _emerge.DependencyArg import DependencyArg -from portage.sets import SETPREFIX +from portage._sets import SETPREFIX class SetArg(DependencyArg): def __init__(self, set=None, **kwargs): DependencyArg.__init__(self, **kwargs) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 99b2a469e..3c735aa2c 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -34,8 +34,8 @@ from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ good = create_color_func("GOOD") bad = create_color_func("BAD") from portage.package.ebuild._ipc.QueryCommand import QueryCommand -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 portage.util import cmp_sort_key, writemsg, \ writemsg_level, writemsg_stdout from portage._global_updates import _global_updates diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index cb9c5d4c0..25429601e 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -24,8 +24,8 @@ from portage.output import bold, blue, colorize, create_color_func, darkblue, \ bad = create_color_func("BAD") from portage.package.ebuild.getmaskingstatus import \ _getmaskingstatus, _MaskReason -from portage.sets import SETPREFIX -from portage.sets.base import InternalPackageSet +from portage._sets import SETPREFIX +from portage._sets.base import InternalPackageSet from portage.util import cmp_sort_key, writemsg, writemsg_stdout from portage.util import writemsg_level diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 3bd72226f..19027ea47 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -32,7 +32,7 @@ from portage.data import secpass from portage.dbapi.dep_expand import dep_expand from portage.util import normalize_path as normpath from portage.util import shlex_split, writemsg_level, writemsg_stdout -from portage.sets import SETPREFIX +from portage._sets import SETPREFIX from portage._global_updates import _global_updates from _emerge.actions import action_config, action_sync, action_metadata, \ @@ -1001,9 +1001,9 @@ def ionice(settings): out.eerror("See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage instructions.") def setconfig_fallback(root_config): - from portage.sets.base import DummyPackageSet - from portage.sets.files import WorldSelectedSet - from portage.sets.profiles import PackagesSystemSet + from portage._sets.base import DummyPackageSet + from portage._sets.files import WorldSelectedSet + from portage._sets.profiles import PackagesSystemSet setconfig = root_config.setconfig setconfig.psets['world'] = DummyPackageSet(atoms=['@selected', '@system']) setconfig.psets['selected'] = WorldSelectedSet(root_config.settings['EROOT']) diff --git a/pym/_emerge/resolver/slot_collision.py b/pym/_emerge/resolver/slot_collision.py index c2156850e..1bde0bea4 100644 --- a/pym/_emerge/resolver/slot_collision.py +++ b/pym/_emerge/resolver/slot_collision.py @@ -5,7 +5,7 @@ from _emerge.Package import Package from _emerge.PackageArg import PackageArg from portage.dep import check_required_use from portage.output import colorize -from portage.sets.base import InternalPackageSet +from portage._sets.base import InternalPackageSet from portage.util import writemsg from portage.versions import cpv_getversion, vercmp diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index 5b466e2d6..dc9030ea2 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -9,7 +9,7 @@ import textwrap import portage from portage import os from portage.output import bold, colorize, darkgreen, green -from portage.sets import SETPREFIX +from portage._sets import SETPREFIX from portage.util import cmp_sort_key from _emerge.emergelog import emergelog @@ -281,7 +281,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 "selected", # as there is no persistent list of "installed" sets diff --git a/pym/portage/sets/__init__.py b/pym/portage/_sets/__init__.py similarity index 95% rename from pym/portage/sets/__init__.py rename to pym/portage/_sets/__init__.py index a942ac94a..66d558f6c 100644 --- a/pym/portage/sets/__init__.py +++ b/pym/portage/_sets/__init__.py @@ -81,16 +81,21 @@ 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") - + + if classname.startswith('portage.sets.'): + # The module has been made private, but we still support + # the previous namespace for sets.conf entries. + classname = classname.replace('sets', '_sets', 1) + # try to import the specified class try: 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 '%(class)s' for section " "'%(section)s'") % {"class": classname, "section": sname}) diff --git a/pym/portage/sets/base.py b/pym/portage/_sets/base.py similarity index 100% rename from pym/portage/sets/base.py rename to pym/portage/_sets/base.py diff --git a/pym/portage/sets/dbapi.py b/pym/portage/_sets/dbapi.py similarity index 99% rename from pym/portage/sets/dbapi.py rename to pym/portage/_sets/dbapi.py index 8bacb72fc..362cc91c6 100644 --- a/pym/portage/sets/dbapi.py +++ b/pym/portage/_sets/dbapi.py @@ -7,8 +7,8 @@ from portage import os from portage.versions import catpkgsplit, catsplit, pkgcmp, best from portage.dep import Atom from portage.localization import _ -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 import portage __all__ = ["CategorySet", "DowngradeSet", diff --git a/pym/portage/sets/files.py b/pym/portage/_sets/files.py similarity index 98% rename from pym/portage/sets/files.py rename to pym/portage/_sets/files.py index 4565c7257..8116d07cd 100644 --- a/pym/portage/sets/files.py +++ b/pym/portage/_sets/files.py @@ -14,8 +14,8 @@ from portage.const import USER_CONFIG_PATH, WORLD_FILE, WORLD_SETS_FILE from portage.localization import _ 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 cpv_getkey diff --git a/pym/portage/sets/libs.py b/pym/portage/_sets/libs.py similarity index 97% rename from pym/portage/sets/libs.py rename to pym/portage/_sets/libs.py index 74c16a129..20347e452 100644 --- a/pym/portage/sets/libs.py +++ b/pym/portage/_sets/libs.py @@ -4,8 +4,8 @@ from __future__ import print_function from portage.localization import _ -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 import portage diff --git a/pym/portage/sets/profiles.py b/pym/portage/_sets/profiles.py similarity index 95% rename from pym/portage/sets/profiles.py rename to pym/portage/_sets/profiles.py index 3e2ab9055..e47f08db3 100644 --- a/pym/portage/sets/profiles.py +++ b/pym/portage/_sets/profiles.py @@ -5,8 +5,8 @@ import logging from portage 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 similarity index 97% rename from pym/portage/sets/security.py rename to pym/portage/_sets/security.py index 61dfed819..2d8fcf667 100644 --- a/pym/portage/sets/security.py +++ b/pym/portage/_sets/security.py @@ -2,9 +2,9 @@ # Distributed under the terms of the GNU General Public License v2 import portage.glsa as glsa -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 similarity index 93% rename from pym/portage/sets/shell.py rename to pym/portage/_sets/shell.py index 2edd82d7e..2c95845c8 100644 --- a/pym/portage/sets/shell.py +++ b/pym/portage/_sets/shell.py @@ -5,8 +5,8 @@ import subprocess from portage import os from portage import _unicode_decode -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/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py index f7707b5ea..854ac43eb 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -12,7 +12,7 @@ from portage.dbapi.porttree import portagetree from portage.dbapi.bintree import binarytree from portage.dep import Atom from portage.package.ebuild.config import config -from portage.sets import load_default_config +from portage._sets import load_default_config from portage.versions import catsplit from _emerge.Blocker import Blocker diff --git a/pym/portage/tests/sets/base/testInternalPackageSet.py b/pym/portage/tests/sets/base/testInternalPackageSet.py index 70b3a1401..e0a347876 100644 --- a/pym/portage/tests/sets/base/testInternalPackageSet.py +++ b/pym/portage/tests/sets/base/testInternalPackageSet.py @@ -5,7 +5,7 @@ from portage.dep import Atom from portage.exception import InvalidAtom from portage.tests import TestCase -from portage.sets.base import InternalPackageSet +from portage._sets.base import InternalPackageSet class InternalPackageSetTestCase(TestCase): """Simple Test Case for InternalPackageSet""" diff --git a/pym/portage/tests/sets/files/testConfigFileSet.py b/pym/portage/tests/sets/files/testConfigFileSet.py index c11228e9c..3ec26a077 100644 --- a/pym/portage/tests/sets/files/testConfigFileSet.py +++ b/pym/portage/tests/sets/files/testConfigFileSet.py @@ -6,7 +6,7 @@ import tempfile from portage import 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 174190dbb..d515a6728 100644 --- a/pym/portage/tests/sets/files/testStaticFileSet.py +++ b/pym/portage/tests/sets/files/testStaticFileSet.py @@ -6,7 +6,7 @@ import tempfile from portage import os from portage.tests import TestCase, test_cps -from portage.sets.files import StaticFileSet +from portage._sets.files import StaticFileSet class StaticFileSetTestCase(TestCase): """Simple Test Case for StaticFileSet""" diff --git a/pym/portage/tests/sets/shell/testShell.py b/pym/portage/tests/sets/shell/testShell.py index dd8825412..2cdd833c3 100644 --- a/pym/portage/tests/sets/shell/testShell.py +++ b/pym/portage/tests/sets/shell/testShell.py @@ -4,7 +4,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