diff options
133 files changed, 347 insertions, 324 deletions
diff --git a/doc/conf.py b/doc/conf.py index dc576710..5a413c81 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,9 +11,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -from importlib import import_module import os import sys +from importlib import import_module # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/examples/changed_use.py b/examples/changed_use.py index f227bb8c..00f39404 100755 --- a/examples/changed_use.py +++ b/examples/changed_use.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # Copyright 2007 Charlie Shepherd -from operator import attrgetter import os import sys +from operator import attrgetter try: - from pkgcore.util import commandline from pkgcore.restrictions.boolean import OrRestriction + from pkgcore.util import commandline except ImportError: print('Cannot import pkgcore!', file=sys.stderr) print('Verify it is properly installed and/or PYTHONPATH is set correctly.', file=sys.stderr) diff --git a/examples/pkg_info.py b/examples/pkg_info.py index fba4efde..77ed4f5f 100755 --- a/examples/pkg_info.py +++ b/examples/pkg_info.py @@ -4,8 +4,8 @@ import itertools import sys try: - from pkgcore.util import commandline from pkgcore.restrictions.boolean import OrRestriction + from pkgcore.util import commandline except ImportError: print('Cannot import pkgcore!', file=sys.stderr) print('Verify it is properly installed and/or PYTHONPATH is set correctly.', file=sys.stderr) diff --git a/examples/repo_list.py b/examples/repo_list.py index 002de9ab..d859a686 100755 --- a/examples/repo_list.py +++ b/examples/repo_list.py @@ -4,8 +4,8 @@ import sys try: - from pkgcore.util import commandline from pkgcore.repository.util import get_raw_repos, get_virtual_repos + from pkgcore.util import commandline except ImportError: print('Cannot import pkgcore!', file=sys.stderr) print('Verify it is properly installed and/or PYTHONPATH is set correctly.', file=sys.stderr) @@ -1,17 +1,17 @@ #!/usr/bin/env python3 -from distutils import log -from distutils.errors import DistutilsExecError -from distutils.util import byte_compile import glob -from itertools import chain import os import subprocess import sys +from distutils import log +from distutils.errors import DistutilsExecError +from distutils.util import byte_compile +from itertools import chain from setuptools import setup - from snakeoil.dist import distutils_extensions as pkgdist + pkgdist_setup, pkgdist_cmds = pkgdist.setup() # These offsets control where we install the pkgcore config files and the EBD diff --git a/src/pkgcore/_vendor/tabulate.py b/src/pkgcore/_vendor/tabulate.py index aa978da5..70a60bef 100644 --- a/src/pkgcore/_vendor/tabulate.py +++ b/src/pkgcore/_vendor/tabulate.py @@ -21,12 +21,12 @@ """Pretty-print tabular data.""" +import math +import re from collections import namedtuple from collections.abc import Iterable -from functools import reduce, partial +from functools import partial, reduce from itertools import zip_longest -import math -import re _none_type = type(None) _bool_type = bool diff --git a/src/pkgcore/binpkg/remote.py b/src/pkgcore/binpkg/remote.py index fa2beb27..bd35e371 100644 --- a/src/pkgcore/binpkg/remote.py +++ b/src/pkgcore/binpkg/remote.py @@ -7,8 +7,8 @@ local binpkg repositories __all__ = ("PackagesCacheV0", "PackagesCacheV1") -from operator import itemgetter import os +from operator import itemgetter from time import time from snakeoil.chksum import get_chksums diff --git a/src/pkgcore/binpkg/repo_ops.py b/src/pkgcore/binpkg/repo_ops.py index 567f7cd4..ac85c685 100644 --- a/src/pkgcore/binpkg/repo_ops.py +++ b/src/pkgcore/binpkg/repo_ops.py @@ -15,12 +15,12 @@ import os from snakeoil.compression import compress_data from snakeoil.klass import steal_docs -from snakeoil.osutils import pjoin, unlink_if_exists, ensure_dirs +from snakeoil.osutils import ensure_dirs, pjoin, unlink_if_exists -from . import xpak from ..fs import tar from ..log import logger from ..operations import repo as repo_interfaces +from . import xpak def discern_loc(base, pkg, extension='.tbz2'): diff --git a/src/pkgcore/binpkg/repository.py b/src/pkgcore/binpkg/repository.py index 97c81dfd..b37a57d0 100644 --- a/src/pkgcore/binpkg/repository.py +++ b/src/pkgcore/binpkg/repository.py @@ -8,23 +8,23 @@ import errno import os from snakeoil import chksum, compression -from snakeoil.data_source import local_source, data_source -from snakeoil.klass import jit_attr, jit_attr_named, alias_attr +from snakeoil.data_source import data_source, local_source +from snakeoil.klass import alias_attr, jit_attr, jit_attr_named from snakeoil.mappings import DictMixin, StackedDict -from snakeoil.osutils import listdir_dirs, listdir_files, access, pjoin +from snakeoil.osutils import access, listdir_dirs, listdir_files, pjoin -from . import remote, repo_ops -from .xpak import Xpak from ..config.hint import ConfigHint from ..ebuild import ebd, ebuild_built from ..ebuild.cpv import VersionedCPV -from ..fs.contents import offset_rewriter, contentsSet +from ..fs.contents import contentsSet, offset_rewriter from ..fs.livefs import scan from ..fs.tar import generate_contents from ..merge import engine, triggers from ..package import base as pkg_base from ..plugin import get_plugin -from ..repository import prototype, errors, wrapper +from ..repository import errors, prototype, wrapper +from . import remote, repo_ops +from .xpak import Xpak class force_unpacking(triggers.base): diff --git a/src/pkgcore/binpkg/xpak.py b/src/pkgcore/binpkg/xpak.py index 6f975071..d7fd8d02 100644 --- a/src/pkgcore/binpkg/xpak.py +++ b/src/pkgcore/binpkg/xpak.py @@ -4,15 +4,14 @@ XPAK container support __all__ = ("MalformedXpak", "Xpak") -from collections import OrderedDict import os +from collections import OrderedDict from snakeoil import klass from snakeoil import struct_compat as struct from ..exceptions import PkgcoreException - # format is: # XPAKPACKIIIIDDDD[index][data]XPAKSTOPOOOOSTOP # first; all ints/longs are big endian diff --git a/src/pkgcore/cache/__init__.py b/src/pkgcore/cache/__init__.py index 50f23a11..25244ae6 100644 --- a/src/pkgcore/cache/__init__.py +++ b/src/pkgcore/cache/__init__.py @@ -4,17 +4,17 @@ cache subsystem, typically used for storing package metadata __all__ = ("base", "bulk") -from functools import partial import math -import os import operator +import os +from functools import partial from snakeoil import klass from snakeoil.chksum import get_handler from snakeoil.mappings import ProtectedDict -from . import errors from ..ebuild.const import metadata_keys +from . import errors class base: diff --git a/src/pkgcore/cache/flat_hash.py b/src/pkgcore/cache/flat_hash.py index 4366b3ae..808e71de 100644 --- a/src/pkgcore/cache/flat_hash.py +++ b/src/pkgcore/cache/flat_hash.py @@ -10,8 +10,8 @@ import stat from snakeoil.fileutils import readlines_utf8 from snakeoil.osutils import pjoin -from . import fs_template, errors from ..config.hint import ConfigHint +from . import errors, fs_template class database(fs_template.FsBased): diff --git a/src/pkgcore/cache/fs_template.py b/src/pkgcore/cache/fs_template.py index 4a4ee86d..f129f43d 100644 --- a/src/pkgcore/cache/fs_template.py +++ b/src/pkgcore/cache/fs_template.py @@ -8,8 +8,8 @@ import os from snakeoil.osutils import ensure_dirs, pjoin -from . import base from ..os_data import portage_gid +from . import base class FsBased(base): diff --git a/src/pkgcore/cache/metadata.py b/src/pkgcore/cache/metadata.py index 6481979a..be3afe3e 100644 --- a/src/pkgcore/cache/metadata.py +++ b/src/pkgcore/cache/metadata.py @@ -6,12 +6,12 @@ __all__ = ("database", "protective_database") import os -from snakeoil.osutils import pjoin from snakeoil.mappings import ProtectedDict +from snakeoil.osutils import pjoin -from . import flat_hash, errors from ..config.hint import ConfigHint from ..ebuild import eclass_cache +from . import errors, flat_hash # store the current key order *here*. diff --git a/src/pkgcore/config/basics.py b/src/pkgcore/config/basics.py index 858957dc..06cd0b97 100644 --- a/src/pkgcore/config/basics.py +++ b/src/pkgcore/config/basics.py @@ -19,7 +19,6 @@ from snakeoil.compatibility import IGNORED_EXCEPTIONS from . import errors from .hint import configurable - type_names = ("list", "str", "bool", "int") diff --git a/src/pkgcore/config/central.py b/src/pkgcore/config/central.py index eccc7e08..e2ca2049 100644 --- a/src/pkgcore/config/central.py +++ b/src/pkgcore/config/central.py @@ -5,14 +5,14 @@ A lot of extra documentation on this is in dev-notes/config.rst. __all__ = ("CollapsedConfig", "ConfigManager",) +import weakref from collections import defaultdict, deque, namedtuple from itertools import chain -import weakref -from snakeoil import mappings, klass +from snakeoil import klass, mappings from snakeoil.compatibility import IGNORED_EXCEPTIONS -from . import errors, basics +from . import basics, errors _section_data = namedtuple('_section_data', ['name', 'section']) diff --git a/src/pkgcore/const.py b/src/pkgcore/const.py index 83dee4bf..51e50dfc 100644 --- a/src/pkgcore/const.py +++ b/src/pkgcore/const.py @@ -9,7 +9,6 @@ from snakeoil import mappings from . import __title__ - osp = os.path _reporoot = osp.realpath(__file__).rsplit(os.path.sep, 3)[0] _module = sys.modules[__name__] diff --git a/src/pkgcore/ebuild/atom.py b/src/pkgcore/ebuild/atom.py index 23d47f20..1d399c00 100644 --- a/src/pkgcore/ebuild/atom.py +++ b/src/pkgcore/ebuild/atom.py @@ -13,10 +13,11 @@ from snakeoil import klass from snakeoil.compatibility import cmp from snakeoil.demandload import demand_compile_regexp -from . import cpv, errors, restricts -from ..restrictions import values, packages, boolean, restriction -from ..restrictions.packages import Conditional, AndRestriction as PkgAndRestriction +from ..restrictions import boolean, packages, restriction, values +from ..restrictions.packages import AndRestriction as PkgAndRestriction +from ..restrictions.packages import Conditional from ..restrictions.values import ContainmentMatch2 +from . import cpv, errors, restricts # namespace compatibility... MalformedAtom = errors.MalformedAtom diff --git a/src/pkgcore/ebuild/conditionals.py b/src/pkgcore/ebuild/conditionals.py index b2edb5e7..7ccc6f0a 100644 --- a/src/pkgcore/ebuild/conditionals.py +++ b/src/pkgcore/ebuild/conditionals.py @@ -10,9 +10,9 @@ from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.iterables import expandable_chain from snakeoil.sequences import iflatten_instance +from ..restrictions import boolean, packages, restriction, values from .atom import atom, transitive_use_atom from .errors import DepsetParseError -from ..restrictions import packages, values, boolean, restriction class DepSet(boolean.AndRestriction): diff --git a/src/pkgcore/ebuild/const.py b/src/pkgcore/ebuild/const.py index 106ca725..edf65bc8 100644 --- a/src/pkgcore/ebuild/const.py +++ b/src/pkgcore/ebuild/const.py @@ -6,7 +6,6 @@ from snakeoil.osutils import pjoin from .. import const - incrementals = ( "ACCEPT_KEYWORDS", "ACCEPT_LICENSE", "CONFIG_PROTECT", "CONFIG_PROTECT_MASK", "FEATURES", "IUSE_IMPLICIT", diff --git a/src/pkgcore/ebuild/cpv.py b/src/pkgcore/ebuild/cpv.py index 49c9e88a..692101d4 100644 --- a/src/pkgcore/ebuild/cpv.py +++ b/src/pkgcore/ebuild/cpv.py @@ -5,10 +5,9 @@ from collections import UserString from snakeoil.compatibility import cmp from snakeoil.demandload import demand_compile_regexp +from ..package import base from . import atom from .errors import InvalidCPV -from ..package import base - demand_compile_regexp( 'suffix_regexp', '^(alpha|beta|rc|pre|p)(\\d*)$') diff --git a/src/pkgcore/ebuild/digest.py b/src/pkgcore/ebuild/digest.py index 00777c47..d8552d30 100644 --- a/src/pkgcore/ebuild/digest.py +++ b/src/pkgcore/ebuild/digest.py @@ -12,9 +12,9 @@ from snakeoil.chksum import get_handler from snakeoil.mappings import ImmutableDict from .. import gpg -from . import cpv -from ..package import errors from ..fs.livefs import iter_scan +from ..package import errors +from . import cpv def _write_manifest(handle, chf, filename, chksums): diff --git a/src/pkgcore/ebuild/domain.py b/src/pkgcore/ebuild/domain.py index 66d7e253..0000e3a5 100644 --- a/src/pkgcore/ebuild/domain.py +++ b/src/pkgcore/ebuild/domain.py @@ -6,47 +6,50 @@ __all__ = ("domain",) # XXX doc this up better... -from collections import defaultdict import copy +import os +import re +import tempfile +from collections import defaultdict from functools import partial from itertools import chain from multiprocessing import cpu_count from operator import itemgetter -import os -import re -import tempfile from snakeoil import klass from snakeoil.bash import iter_read_bash, read_bash_dict from snakeoil.cli.exceptions import find_user_exception from snakeoil.data_source import local_source -from snakeoil.mappings import ProtectedDict, ImmutableDict from snakeoil.log import suppress_logging +from snakeoil.mappings import ImmutableDict, ProtectedDict from snakeoil.osutils import pjoin from snakeoil.process.spawn import spawn_get_output -from snakeoil.sequences import split_negations, stable_unique, predicate_split +from snakeoil.sequences import predicate_split, split_negations, stable_unique from ..binpkg import repository as binary_repo from ..cache.flat_hash import md5_cache from ..config import errors as config_errors -from ..config.domain import Failure, domain as config_domain +from ..config.domain import Failure +from ..config.domain import domain as config_domain from ..config.hint import ConfigHint -from . import const, repository as ebuild_repo -from .atom import atom as _atom -from .misc import ( - ChunkedDataDict, chunked_data, collapsed_restrict_to_data, - incremental_expansion, incremental_expansion_license, - non_incremental_collapsed_restrict_to_data, optimize_incrementals) -from .portage_conf import PortageConfig -from .repo_objs import RepoConfig, OverlayedLicenses -from .triggers import GenerateTriggers from ..fs.livefs import iter_scan, sorted_scan from ..log import logger -from ..repository import filtered, errors as repo_errors +from ..repository import errors as repo_errors +from ..repository import filtered from ..repository.util import RepositoryGroup from ..restrictions import packages, values from ..restrictions.delegated import delegate -from ..util.parserestrict import parse_match, ParseError +from ..util.parserestrict import ParseError, parse_match +from . import const +from . import repository as ebuild_repo +from .atom import atom as _atom +from .misc import (ChunkedDataDict, chunked_data, collapsed_restrict_to_data, + incremental_expansion, incremental_expansion_license, + non_incremental_collapsed_restrict_to_data, + optimize_incrementals) +from .portage_conf import PortageConfig +from .repo_objs import OverlayedLicenses, RepoConfig +from .triggers import GenerateTriggers def package_masks(iterable): diff --git a/src/pkgcore/ebuild/eapi.py b/src/pkgcore/ebuild/eapi.py index 67dad314..84f27449 100644 --- a/src/pkgcore/ebuild/eapi.py +++ b/src/pkgcore/ebuild/eapi.py @@ -1,18 +1,17 @@ -from collections import defaultdict -from functools import partial import os import re import subprocess import sys +from collections import defaultdict +from functools import partial -from snakeoil import mappings, weakrefs, klass +from snakeoil import klass, mappings, weakrefs from snakeoil.demandload import demand_compile_regexp from snakeoil.osutils import pjoin from snakeoil.process.spawn import bash_version -from . import atom, const from ..log import logger - +from . import atom, const demand_compile_regexp( '_valid_EAPI_regex', r"^[A-Za-z0-9_][A-Za-z0-9+_.-]*$" diff --git a/src/pkgcore/ebuild/ebd.py b/src/pkgcore/ebuild/ebd.py index 79b56f85..7b6d09db 100644 --- a/src/pkgcore/ebuild/ebd.py +++ b/src/pkgcore/ebuild/ebd.py @@ -9,36 +9,36 @@ __all__ = ( "ebd", "setup_mixin", "install_op", "uninstall_op", "replace_op", "buildable", "binpkg_localize") -from collections import defaultdict import errno -from functools import partial -from itertools import chain import os import re import shutil import sys -from tempfile import TemporaryFile import time +from collections import defaultdict +from functools import partial +from itertools import chain +from tempfile import TemporaryFile from snakeoil import data_source, klass from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.contexts import chdir from snakeoil.currying import post_curry, pretty_docs from snakeoil.fileutils import touch -from snakeoil.osutils import ensure_dirs, normpath, pjoin, listdir_files -from snakeoil.process.spawn import ( - spawn_bash, spawn, is_sandbox_capable, is_userpriv_capable) +from snakeoil.osutils import ensure_dirs, listdir_files, normpath, pjoin +from snakeoil.process.spawn import (is_sandbox_capable, is_userpriv_capable, + spawn, spawn_bash) from snakeoil.sequences import iflatten_instance, iter_stable_unique from .. import const -from . import ebd_ipc, ebuild_built, errors -from .processor import ( - request_ebuild_processor, release_ebuild_processor, ProcessorError, - expected_ebuild_env, chuck_UnhandledCommand, inherit_handler) from ..log import logger -from ..operations import observer, format +from ..operations import format, observer from ..os_data import portage_gid, portage_uid, xargs from ..package.mutated import MutatedPkg +from . import ebd_ipc, ebuild_built, errors +from .processor import (ProcessorError, chuck_UnhandledCommand, + expected_ebuild_env, inherit_handler, + release_ebuild_processor, request_ebuild_processor) class ebd: diff --git a/src/pkgcore/ebuild/ebd_ipc.py b/src/pkgcore/ebuild/ebd_ipc.py index 2fc905a2..60456615 100644 --- a/src/pkgcore/ebuild/ebd_ipc.py +++ b/src/pkgcore/ebuild/ebd_ipc.py @@ -2,25 +2,26 @@ import argparse import grp import itertools import locale -from operator import itemgetter import os import pwd import re import shlex import shutil import stat +from operator import itemgetter from snakeoil.cli import arghparse -from snakeoil.contexts import chdir from snakeoil.compression import ArComp, ArCompError +from snakeoil.contexts import chdir from snakeoil.decorators import coroutine from snakeoil.iterables import partition from snakeoil.osutils import pjoin from snakeoil.process import spawn from .. import os_data -from . import atom as atom_mod, filter_env, portageq from ..exceptions import PkgcoreException, PkgcoreUserException +from . import atom as atom_mod +from . import filter_env, portageq class IpcError(PkgcoreException): diff --git a/src/pkgcore/ebuild/ebuild_built.py b/src/pkgcore/ebuild/ebuild_built.py index b83ad253..432a7484 100644 --- a/src/pkgcore/ebuild/ebuild_built.py +++ b/src/pkgcore/ebuild/ebuild_built.py @@ -4,8 +4,8 @@ built ebuild packages (vdb packages and binpkgs are derivatives of this) __all__ = ("package", "package_factory") -from functools import partial import itertools +from functools import partial from snakeoil.currying import post_curry from snakeoil.data_source import local_source @@ -13,12 +13,12 @@ from snakeoil.mappings import IndeterminantDict from snakeoil.obj import DelayedInstantiation from .. import fetch -from . import ebd, ebuild_src, conditionals, triggers -from .eapi import get_eapi from ..fs.livefs import scan from ..merge import engine from ..package import metadata from ..package.base import DynamicGetattrSetter +from . import conditionals, ebd, ebuild_src, triggers +from .eapi import get_eapi def _passthrough(inst, attr): diff --git a/src/pkgcore/ebuild/ebuild_src.py b/src/pkgcore/ebuild/ebuild_src.py index ddd4ef28..948c9b44 100644 --- a/src/pkgcore/ebuild/ebuild_src.py +++ b/src/pkgcore/ebuild/ebuild_src.py @@ -4,9 +4,9 @@ package class for buildable ebuilds __all__ = ("base", "package", "package_factory") +import os from functools import partial from itertools import chain -import os from sys import intern from snakeoil import chksum, data_source, fileutils, klass @@ -14,15 +14,17 @@ from snakeoil.demandload import demand_compile_regexp from .. import fetch from ..cache import errors as cache_errors -from . import conditionals, processor, errors as ebuild_errors -from .atom import atom -from .eapi import get_eapi -from .misc import sort_keywords from ..log import logger -from ..package import errors as metadata_errors, metadata +from ..package import errors as metadata_errors +from ..package import metadata from ..package.base import DynamicGetattrSetter from ..restrictions import boolean, values - +from . import conditionals +from . import errors as ebuild_errors +from . import processor +from .atom import atom +from .eapi import get_eapi +from .misc import sort_keywords demand_compile_regexp( '_EAPI_regex', r"^EAPI=(['\"]?)(?P<EAPI>[A-Za-z0-9+_.-]*)\1[\t ]*(?:#.*)?") diff --git a/src/pkgcore/ebuild/eclass_cache.py b/src/pkgcore/ebuild/eclass_cache.py index f6f1e189..57e9c529 100644 --- a/src/pkgcore/ebuild/eclass_cache.py +++ b/src/pkgcore/ebuild/eclass_cache.py @@ -11,7 +11,7 @@ from snakeoil.chksum import LazilyHashedPath from snakeoil.data_source import local_source from snakeoil.klass import jit_attr_ext_method from snakeoil.mappings import ImmutableDict, StackedDict -from snakeoil.osutils import normpath, pjoin, listdir_files +from snakeoil.osutils import listdir_files, normpath, pjoin from snakeoil.weakrefs import WeakValCache from ..config.hint import ConfigHint diff --git a/src/pkgcore/ebuild/filter_env.py b/src/pkgcore/ebuild/filter_env.py index 96572cd3..cc296065 100644 --- a/src/pkgcore/ebuild/filter_env.py +++ b/src/pkgcore/ebuild/filter_env.py @@ -7,7 +7,6 @@ import re from ..log import logger - COMMAND_PARSING, SPACE_PARSING = list(range(2)) diff --git a/src/pkgcore/ebuild/inspect_profile.py b/src/pkgcore/ebuild/inspect_profile.py index b9644b25..a0be246c 100644 --- a/src/pkgcore/ebuild/inspect_profile.py +++ b/src/pkgcore/ebuild/inspect_profile.py @@ -1,16 +1,15 @@ import argparse +import operator from collections import defaultdict from itertools import chain -import operator from snakeoil.cli import arghparse from snakeoil.osutils import pjoin from snakeoil.sequences import split_negations +from ..util import commandline from . import atom, profiles from .misc import ChunkedDataDict -from ..util import commandline - commands = [] # info: keywords known diff --git a/src/pkgcore/ebuild/misc.py b/src/pkgcore/ebuild/misc.py index 058b01c6..ed032997 100644 --- a/src/pkgcore/ebuild/misc.py +++ b/src/pkgcore/ebuild/misc.py @@ -16,11 +16,11 @@ from functools import partial from itertools import chain from snakeoil import mappings -from snakeoil.klass import generic_equality, alias_method +from snakeoil.klass import alias_method, generic_equality from snakeoil.sequences import iflatten_instance +from ..restrictions import boolean, packages, restriction from . import atom -from ..restrictions import packages, restriction, boolean restrict_payload = namedtuple("restrict_data", ["restrict", "data"]) chunked_data = namedtuple("chunked_data", ("key", "neg", "pos")) diff --git a/src/pkgcore/ebuild/pkg_updates.py b/src/pkgcore/ebuild/pkg_updates.py index aaacdfe6..ea6eb7bd 100644 --- a/src/pkgcore/ebuild/pkg_updates.py +++ b/src/pkgcore/ebuild/pkg_updates.py @@ -1,12 +1,12 @@ -from collections import deque, defaultdict +from collections import defaultdict, deque from operator import itemgetter from snakeoil.demandload import demand_compile_regexp from snakeoil.osutils import listdir_files, pjoin from snakeoil.sequences import iflatten_instance -from .atom import atom from ..log import logger +from .atom import atom demand_compile_regexp('valid_updates_re', r'^([1-4])Q-(\d{4})$') diff --git a/src/pkgcore/ebuild/portage_conf.py b/src/pkgcore/ebuild/portage_conf.py index ada2de1f..56169eba 100644 --- a/src/pkgcore/ebuild/portage_conf.py +++ b/src/pkgcore/ebuild/portage_conf.py @@ -8,24 +8,27 @@ __all__ = ( ) import configparser -from collections import OrderedDict import errno import os +from collections import OrderedDict from snakeoil.bash import read_bash_dict from snakeoil.compatibility import IGNORED_EXCEPTIONS -from snakeoil.mappings import ImmutableDict, DictMixin -from snakeoil.osutils import access, normpath, abspath, listdir_files, pjoin +from snakeoil.mappings import DictMixin, ImmutableDict +from snakeoil.osutils import abspath, access, listdir_files, normpath, pjoin -from .. import const, exceptions as base_errors -from ..config import basics, errors as config_errors +from .. import const +from .. import exceptions as base_errors +from ..config import basics +from ..config import errors as config_errors from ..config.hint import configurable -from . import const as econst, profiles, repo_objs -from .misc import optimize_incrementals -from .repository import errors as repo_errors from ..fs.livefs import sorted_scan from ..log import logger from ..pkgsets.glsa import SecurityUpgrades +from . import const as econst +from . import profiles, repo_objs +from .misc import optimize_incrementals +from .repository import errors as repo_errors def my_convert_hybrid(manager, val, arg_type): diff --git a/src/pkgcore/ebuild/portageq.py b/src/pkgcore/ebuild/portageq.py index bde90ba2..cf497489 100644 --- a/src/pkgcore/ebuild/portageq.py +++ b/src/pkgcore/ebuild/portageq.py @@ -1,13 +1,13 @@ -from functools import partial import os +from functools import partial from snakeoil import osutils from snakeoil.cli import arghparse -from . import atom, conditionals -from .eapi import get_eapi from ..restrictions.boolean import AndRestriction from ..util import commandline, packages +from . import atom, conditionals +from .eapi import get_eapi def str_pkg(pkg): diff --git a/src/pkgcore/ebuild/processor.py b/src/pkgcore/ebuild/processor.py index 356cd349..a65d6969 100644 --- a/src/pkgcore/ebuild/processor.py +++ b/src/pkgcore/ebuild/processor.py @@ -20,24 +20,23 @@ __all__ = ( import contextlib import errno -from functools import partial, wraps import logging -from itertools import chain import os import signal import sys import threading import traceback +from functools import partial, wraps +from itertools import chain from snakeoil import bash, fileutils, klass, process from snakeoil.osutils import abspath, normpath, pjoin from snakeoil.process import spawn from .. import __file__, const, os_data -from . import const as e_const from ..exceptions import PkgcoreException, PkgcoreUserException from ..log import logger - +from . import const as e_const _global_ebp_lock = threading.Lock() inactive_ebp_list = [] diff --git a/src/pkgcore/ebuild/profiles.py b/src/pkgcore/ebuild/profiles.py index 71b36d01..8eece9d7 100644 --- a/src/pkgcore/ebuild/profiles.py +++ b/src/pkgcore/ebuild/profiles.py @@ -3,10 +3,10 @@ __all__ = ( "UserProfile", ) +import os from collections import defaultdict, namedtuple from functools import partial from itertools import chain -import os from snakeoil import caching, klass from snakeoil.bash import iter_read_bash, read_bash_dict @@ -19,11 +19,13 @@ from snakeoil.sequences import split_negations, stable_unique from ..config import errors from ..config.hint import ConfigHint -from . import const, ebuild_src, misc, cpv, repo_objs, errors as ebuild_errors -from .atom import atom -from .eapi import get_eapi from ..fs.livefs import sorted_scan from ..log import logger +from . import const, cpv, ebuild_src +from . import errors as ebuild_errors +from . import misc, repo_objs +from .atom import atom +from .eapi import get_eapi def package_keywords_splitter(iterable): diff --git a/src/pkgcore/ebuild/repo_objs.py b/src/pkgcore/ebuild/repo_objs.py index a99671b4..76d3d0ea 100644 --- a/src/pkgcore/ebuild/repo_objs.py +++ b/src/pkgcore/ebuild/repo_objs.py @@ -8,33 +8,34 @@ __all__ = ( "Project", "ProjectMember", "Subproject", "ProjectsXml", "LocalProjectsXml" ) -from collections import namedtuple import errno -from itertools import chain -from lxml import etree import os import platform import subprocess +from collections import namedtuple +from itertools import chain from sys import intern +from lxml import etree from snakeoil import klass, mappings from snakeoil.bash import BashParseError, iter_read_bash, read_dict from snakeoil.caching import WeakInstMeta from snakeoil.currying import post_curry from snakeoil.fileutils import readfile, readlines -from snakeoil.osutils import pjoin, listdir_files, listdir +from snakeoil.osutils import listdir, listdir_files, pjoin from snakeoil.osutils.mount import umount from snakeoil.process.namespaces import simple_unshare from snakeoil.sequences import iter_stable_unique from snakeoil.strings import pluralism from ..config.hint import ConfigHint -from . import atom, profiles, pkg_updates -from .eapi import get_eapi from ..exceptions import PermissionDenied from ..log import logger -from ..repository import syncable, errors as repo_errors +from ..repository import errors as repo_errors +from ..repository import syncable from ..restrictions import packages +from . import atom, pkg_updates, profiles +from .eapi import get_eapi class Maintainer: diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py index 6831c174..30faba50 100644 --- a/src/pkgcore/ebuild/repository.py +++ b/src/pkgcore/ebuild/repository.py @@ -4,12 +4,12 @@ Ebuild repository, specific to gentoo ebuild trees. __all__ = ("UnconfiguredTree", "ConfiguredTree", "ProvidesRepo", "tree") -from functools import partial, wraps -from itertools import chain, filterfalse import locale -from operator import attrgetter import os import stat +from functools import partial, wraps +from itertools import chain, filterfalse +from operator import attrgetter from random import shuffle from sys import intern @@ -20,26 +20,26 @@ from snakeoil.data_source import local_source from snakeoil.fileutils import readlines from snakeoil.mappings import ImmutableDict from snakeoil.obj import make_kls -from snakeoil.osutils import listdir_files, listdir_dirs, pjoin +from snakeoil.osutils import listdir_dirs, listdir_files, pjoin from snakeoil.sequences import iflatten_instance, stable_unique from snakeoil.strings import pluralism as _pl from snakeoil.weakrefs import WeakValCache from .. import fetch from ..config.hint import ConfigHint, configurable -from . import ( - cpv, digest, ebd, repo_objs, atom, restricts, processor, - ebuild_src, eclass_cache as eclass_cache_mod, errors as ebuild_errors, -) -from .eapi import get_eapi from ..fs.livefs import sorted_scan from ..log import logger from ..operations import repo as _repo_ops from ..package import errors as pkg_errors -from ..repository import prototype, errors, configured, util +from ..repository import configured, errors, prototype, util from ..repository.virtual import RestrictionRepo from ..restrictions import packages from ..util.packages import groupby_pkg +from . import atom, cpv, digest, ebd, ebuild_src +from . import eclass_cache as eclass_cache_mod +from . import errors as ebuild_errors +from . import processor, repo_objs, restricts +from .eapi import get_eapi class repo_operations(_repo_ops.operations): diff --git a/src/pkgcore/ebuild/resolver.py b/src/pkgcore/ebuild/resolver.py index 061e5cb7..ce250618 100644 --- a/src/pkgcore/ebuild/resolver.py +++ b/src/pkgcore/ebuild/resolver.py @@ -7,10 +7,10 @@ __all__ = ["upgrade_resolver", "min_install_resolver"] from functools import partial from itertools import chain -from .atom import atom from ..repository import misc, multiplex from ..resolver import plan from ..restrictions import packages, values +from .atom import atom def upgrade_resolver(vdbs, dbs, verify_vdb=True, nodeps=False, diff --git a/src/pkgcore/ebuild/restricts.py b/src/pkgcore/ebuild/restricts.py index 77b711ac..3ea3f08d 100644 --- a/src/pkgcore/ebuild/restricts.py +++ b/src/pkgcore/ebuild/restricts.py @@ -9,8 +9,8 @@ __all__ = ("VersionMatch",) from snakeoil.klass import generic_equality -from . import cpv, errors from ..restrictions import packages, restriction, values +from . import cpv, errors # TODO: change values.EqualityMatch so it supports le, lt, gt, ge, eq, diff --git a/src/pkgcore/ebuild/triggers.py b/src/pkgcore/ebuild/triggers.py index 7f6f2fa7..53d6c287 100644 --- a/src/pkgcore/ebuild/triggers.py +++ b/src/pkgcore/ebuild/triggers.py @@ -13,16 +13,15 @@ import os from snakeoil.bash import read_bash_dict from snakeoil.fileutils import AtomicWriteFile from snakeoil.osutils import listdir_files, normpath, pjoin -from snakeoil.sequences import stable_unique, iflatten_instance +from snakeoil.sequences import iflatten_instance, stable_unique from .. import os_data, ospkg from ..fs import livefs from ..log import logger -from ..merge import triggers, const, errors +from ..merge import const, errors, triggers from ..restrictions import values from ..system import libtool - colon_parsed = frozenset([ "ADA_INCLUDE_PATH", "ADA_OBJECTS_PATH", "INFODIR", "INFOPATH", "LDPATH", "MANPATH", "PATH", "PYTHONPATH", "PKG_CONFIG_PATH", "ROOTPATH" diff --git a/src/pkgcore/fetch/base.py b/src/pkgcore/fetch/base.py index 40c6086e..b07463c5 100644 --- a/src/pkgcore/fetch/base.py +++ b/src/pkgcore/fetch/base.py @@ -6,7 +6,7 @@ __all__ = ("fetcher",) import os -from snakeoil.chksum import get_handlers, get_chksums, MissingChksumHandler +from snakeoil.chksum import MissingChksumHandler, get_chksums, get_handlers from . import errors diff --git a/src/pkgcore/fetch/custom.py b/src/pkgcore/fetch/custom.py index b19d5b1d..845d09ed 100644 --- a/src/pkgcore/fetch/custom.py +++ b/src/pkgcore/fetch/custom.py @@ -7,11 +7,11 @@ __all__ = ("MalformedCommand", "fetcher",) import os from snakeoil.osutils import ensure_dirs, pjoin -from snakeoil.process.spawn import spawn_bash, is_userpriv_capable +from snakeoil.process.spawn import is_userpriv_capable, spawn_bash from ..config.hint import ConfigHint -from . import errors, base, fetchable -from ..os_data import portage_uid, portage_gid +from ..os_data import portage_gid, portage_uid +from . import base, errors, fetchable class MalformedCommand(errors.FetchError): diff --git a/src/pkgcore/fs/contents.py b/src/pkgcore/fs/contents.py index b88739d0..0202543c 100644 --- a/src/pkgcore/fs/contents.py +++ b/src/pkgcore/fs/contents.py @@ -2,13 +2,13 @@ contents set- container of fs objects """ -from collections import defaultdict, OrderedDict -from functools import partial -from operator import attrgetter import os import time +from collections import OrderedDict, defaultdict +from functools import partial +from operator import attrgetter -from snakeoil.klass import generic_equality, alias_method +from snakeoil.klass import alias_method, generic_equality from snakeoil.osutils import normpath, pjoin from . import fs diff --git a/src/pkgcore/fs/fs.py b/src/pkgcore/fs/fs.py index 2128a9ae..9ed839b4 100644 --- a/src/pkgcore/fs/fs.py +++ b/src/pkgcore/fs/fs.py @@ -3,18 +3,18 @@ filesystem entry abstractions """ import fnmatch -from os.path import sep as path_seperator, realpath, abspath, dirname, basename import stat +from os.path import abspath, basename, dirname, realpath +from os.path import sep as path_seperator from snakeoil import klass -from snakeoil.chksum import get_handlers, get_chksums +from snakeoil.chksum import get_chksums, get_handlers from snakeoil.compatibility import cmp from snakeoil.currying import post_curry, pretty_docs from snakeoil.data_source import local_source from snakeoil.mappings import LazyFullValLoadDict from snakeoil.osutils import normpath, pjoin - # goofy set of classes representating the fs objects pkgcore knows of. __all__ = [ diff --git a/src/pkgcore/fs/livefs.py b/src/pkgcore/fs/livefs.py index f23c534d..484fa681 100644 --- a/src/pkgcore/fs/livefs.py +++ b/src/pkgcore/fs/livefs.py @@ -5,17 +5,16 @@ interaction with the livefs: generating fs objects to represent the livefs. import collections import errno import os -from stat import S_IMODE, S_ISDIR, S_ISREG, S_ISLNK, S_ISFIFO +from stat import S_IMODE, S_ISDIR, S_ISFIFO, S_ISLNK, S_ISREG from snakeoil.chksum import get_handlers from snakeoil.data_source import local_source -from snakeoil.osutils import normpath, pjoin from snakeoil.mappings import LazyValDict -from snakeoil.osutils import listdir +from snakeoil.osutils import listdir, normpath, pjoin from .contents import contentsSet -from .fs import ( - fsFile, fsDir, fsSymlink, fsDev, fsFifo, get_major_minor, fsBase) +from .fs import (fsBase, fsDev, fsDir, fsFifo, fsFile, fsSymlink, + get_major_minor) __all__ = ["gen_obj", "scan", "iter_scan", "sorted_scan"] diff --git a/src/pkgcore/fs/ops.py b/src/pkgcore/fs/ops.py index 09634a26..05e480dc 100644 --- a/src/pkgcore/fs/ops.py +++ b/src/pkgcore/fs/ops.py @@ -6,17 +6,16 @@ Shouldn't be accessed directly for the most part, use """ import errno -from functools import partial import os +from functools import partial from snakeoil.osutils import ensure_dirs, pjoin, unlink_if_exists from snakeoil.process.spawn import spawn from ..const import CP_BINARY +from ..plugin import get_plugin from . import contents, fs from .livefs import gen_obj -from ..plugin import get_plugin - __all__ = [ "merge_contents", "unmerge_contents", "default_ensure_perms", diff --git a/src/pkgcore/fs/tar.py b/src/pkgcore/fs/tar.py index cf91ae88..00801dfa 100644 --- a/src/pkgcore/fs/tar.py +++ b/src/pkgcore/fs/tar.py @@ -2,10 +2,10 @@ binpkg tar utilities """ -from functools import partial -from itertools import count import os import stat +from functools import partial +from itertools import count from snakeoil import compression from snakeoil.compatibility import cmp, sorted_cmp @@ -13,7 +13,7 @@ from snakeoil.data_source import invokable_data_source from snakeoil.tar import tarfile from . import contents -from .fs import fsFile, fsDir, fsSymlink, fsFifo, fsDev +from .fs import fsDev, fsDir, fsFifo, fsFile, fsSymlink _unique_inode = count(2**32).__next__ diff --git a/src/pkgcore/merge/engine.py b/src/pkgcore/merge/engine.py index ae6877f8..99009b27 100644 --- a/src/pkgcore/merge/engine.py +++ b/src/pkgcore/merge/engine.py @@ -10,26 +10,26 @@ __all__ = ("alias_cset", "map_new_cset_livefs", "MergeEngine") # post merge triggers # ordering? -from functools import partial -from itertools import chain import io -from multiprocessing import cpu_count import operator import tempfile import traceback +from functools import partial +from itertools import chain +from multiprocessing import cpu_count from snakeoil import data_source from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.currying import post_curry from snakeoil.fileutils import touch -from snakeoil.mappings import LazyValDict, ImmutableDict, StackedDict +from snakeoil.mappings import ImmutableDict, LazyValDict, StackedDict from snakeoil.osutils import normpath from ..fs import contents, livefs -from . import errors -from .const import REPLACE_MODE, INSTALL_MODE, UNINSTALL_MODE from ..operations import observer as observer_mod from ..plugin import get_plugins +from . import errors +from .const import INSTALL_MODE, REPLACE_MODE, UNINSTALL_MODE def alias_cset(alias, engine, csets): diff --git a/src/pkgcore/merge/triggers.py b/src/pkgcore/merge/triggers.py index 407d54af..767f70fb 100644 --- a/src/pkgcore/merge/triggers.py +++ b/src/pkgcore/merge/triggers.py @@ -22,28 +22,27 @@ __all__ = ( "InfoRegen", ) -from math import floor import os import platform import re import time +from math import floor from snakeoil import process from snakeoil.bash import iter_read_bash from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.fileutils import touch -from snakeoil.osutils import listdir_files, pjoin, ensure_dirs, normpath +from snakeoil.osutils import ensure_dirs, listdir_files, normpath, pjoin from snakeoil.process import spawn from .. import os_data -from ..fs import fs, contents +from ..fs import contents, fs from ..fs.livefs import gen_obj -from . import errors, const from ..operations.observer import threadsafe_repo_observer from ..package.mutated import MutatedPkg from ..plugin import get_plugin from ..util import file_type, thread_pool - +from . import const, errors UNINSTALLING_MODES = (const.REPLACE_MODE, const.UNINSTALL_MODE) INSTALLING_MODES = (const.REPLACE_MODE, const.INSTALL_MODE) diff --git a/src/pkgcore/operations/format.py b/src/pkgcore/operations/format.py index 8d79cb3d..c2ed54c7 100644 --- a/src/pkgcore/operations/format.py +++ b/src/pkgcore/operations/format.py @@ -14,7 +14,8 @@ from snakeoil.dependant_methods import ForcedDepends from snakeoil.osutils import pjoin from snakeoil.sequences import iflatten_instance -from .. import fetch as _fetch_module, operations as _operations_mod +from .. import fetch as _fetch_module +from .. import operations as _operations_mod from ..exceptions import PkgcoreUserException from ..fetch import errors as fetch_errors diff --git a/src/pkgcore/operations/repo.py b/src/pkgcore/operations/repo.py index aaf452de..35d6aa0f 100644 --- a/src/pkgcore/operations/repo.py +++ b/src/pkgcore/operations/repo.py @@ -16,10 +16,11 @@ from snakeoil.dependant_methods import ForcedDepends from .. import operations as operations_mod from ..exceptions import PkgcoreException from ..log import logger -from . import observer as observer_mod, regen from ..package.mutated import MutatedPkg from ..restrictions import packages from ..sync import base as _sync_base +from . import observer as observer_mod +from . import regen class fake_lock: diff --git a/src/pkgcore/ospkg/deb.py b/src/pkgcore/ospkg/deb.py index 60c52c8f..3f0de46a 100644 --- a/src/pkgcore/ospkg/deb.py +++ b/src/pkgcore/ospkg/deb.py @@ -4,7 +4,7 @@ from snakeoil.data_source import text_data_source from snakeoil.osutils import pjoin, unlink_if_exists from snakeoil.process.spawn import spawn -from ..fs import tar, fs, contents +from ..fs import contents, fs, tar OPS = { '>=': (True, '>='), diff --git a/src/pkgcore/ospkg/triggers.py b/src/pkgcore/ospkg/triggers.py index f6084b45..81d240ee 100644 --- a/src/pkgcore/ospkg/triggers.py +++ b/src/pkgcore/ospkg/triggers.py @@ -1,4 +1,4 @@ -from snakeoil.osutils import pjoin, ensure_dirs +from snakeoil.osutils import ensure_dirs, pjoin from ..merge import triggers from . import deb diff --git a/src/pkgcore/package/virtual.py b/src/pkgcore/package/virtual.py index 39d06c71..66c5824c 100644 --- a/src/pkgcore/package/virtual.py +++ b/src/pkgcore/package/virtual.py @@ -4,8 +4,8 @@ virtual package __all__ = ("package", "factory") -from . import metadata from ..restrictions.packages import OrRestriction +from . import metadata class package(metadata.package): diff --git a/src/pkgcore/pkgsets/glsa.py b/src/pkgcore/pkgsets/glsa.py index c3e1d7c7..33968c3a 100644 --- a/src/pkgcore/pkgsets/glsa.py +++ b/src/pkgcore/pkgsets/glsa.py @@ -5,15 +5,16 @@ Gentoo Linux Security Advisories (GLSA) support __all__ = ("GlsaDirSet", "SecurityUpgrades") import os -from lxml import etree +from lxml import etree from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.iterables import caching_iter from snakeoil.klass import generic_equality from snakeoil.osutils import listdir_files, pjoin from ..config.hint import ConfigHint -from ..ebuild import cpv, atom, restricts as atom_restricts +from ..ebuild import atom, cpv +from ..ebuild import restricts as atom_restricts from ..log import logger from ..package import mutated from ..repository.util import get_virtual_repos diff --git a/src/pkgcore/pkgsets/live_rebuild_set.py b/src/pkgcore/pkgsets/live_rebuild_set.py index b3ef47a3..012e48d1 100644 --- a/src/pkgcore/pkgsets/live_rebuild_set.py +++ b/src/pkgcore/pkgsets/live_rebuild_set.py @@ -4,8 +4,8 @@ Note: HACK. Quick proof of concept, could do with cleaning up. """ from ..config.hint import ConfigHint -from .installed import VersionedInstalled from ..repository.util import RepositoryGroup +from .installed import VersionedInstalled class EclassConsumerSet(VersionedInstalled): diff --git a/src/pkgcore/plugin.py b/src/pkgcore/plugin.py index 32d6159c..fbcf497b 100644 --- a/src/pkgcore/plugin.py +++ b/src/pkgcore/plugin.py @@ -13,21 +13,21 @@ __all__ = ("initialize_cache", "get_plugins", "get_plugin") # latter an installed plugin issue. May have to change this if it # causes problems. -from collections import defaultdict, namedtuple -from importlib import import_module import operator import os.path import sys +from collections import defaultdict, namedtuple +from importlib import import_module from snakeoil import mappings, modules from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.fileutils import AtomicWriteFile, readlines_ascii -from snakeoil.osutils import pjoin, listdir_files, ensure_dirs, unlink_if_exists +from snakeoil.osutils import (ensure_dirs, listdir_files, pjoin, + unlink_if_exists) from . import const, os_data from .log import logger - _plugin_data = namedtuple( "_plugin_data", ["key", "priority", "source", "target"]) diff --git a/src/pkgcore/plugins/__init__.py b/src/pkgcore/plugins/__init__.py index a746de2b..10952924 100644 --- a/src/pkgcore/plugins/__init__.py +++ b/src/pkgcore/plugins/__init__.py @@ -1,4 +1,5 @@ """pkgcore plugins package.""" from ..plugin import extend_path + extend_path(__path__, __name__) diff --git a/src/pkgcore/repository/configured.py b/src/pkgcore/repository/configured.py index c0778cc2..93d019cd 100644 --- a/src/pkgcore/repository/configured.py +++ b/src/pkgcore/repository/configured.py @@ -6,7 +6,7 @@ __all__ = ("tree",) from functools import partial -from snakeoil.klass import GetAttrProxy, DirProxy +from snakeoil.klass import DirProxy, GetAttrProxy from ..operations.repo import operations_proxy from ..package.conditionals import make_wrapper diff --git a/src/pkgcore/repository/filtered.py b/src/pkgcore/repository/filtered.py index 6097df5f..d1b7f09b 100644 --- a/src/pkgcore/repository/filtered.py +++ b/src/pkgcore/repository/filtered.py @@ -6,11 +6,11 @@ __all__ = ("tree",) from itertools import filterfalse -from snakeoil.klass import GetAttrProxy, DirProxy +from snakeoil.klass import DirProxy, GetAttrProxy from ..operations.repo import operations_proxy -from . import prototype, errors from ..restrictions import restriction +from . import errors, prototype class tree(prototype.tree): diff --git a/src/pkgcore/repository/misc.py b/src/pkgcore/repository/misc.py index c9883555..f50bfc9f 100644 --- a/src/pkgcore/repository/misc.py +++ b/src/pkgcore/repository/misc.py @@ -1,7 +1,7 @@ __all__ = ("nodeps_repo", "caching_repo") from snakeoil.iterables import caching_iter, iter_sort -from snakeoil.klass import GetAttrProxy, DirProxy +from snakeoil.klass import DirProxy, GetAttrProxy from ..ebuild.conditionals import DepSet from ..operations.repo import operations_proxy diff --git a/src/pkgcore/repository/multiplex.py b/src/pkgcore/repository/multiplex.py index c4cde3de..1e7969d8 100644 --- a/src/pkgcore/repository/multiplex.py +++ b/src/pkgcore/repository/multiplex.py @@ -4,10 +4,10 @@ repository that combines multiple repos together __all__ = ("tree", "operations") +import os from functools import partial from itertools import chain from operator import itemgetter -import os from snakeoil import klass from snakeoil.compatibility import sorted_cmp @@ -16,7 +16,7 @@ from snakeoil.iterables import iter_sort from ..config.hint import configurable from ..operations import repo as repo_interface -from . import prototype, errors +from . import errors, prototype class operations(repo_interface.operations_proxy): diff --git a/src/pkgcore/repository/prototype.py b/src/pkgcore/repository/prototype.py index ceb6f8f4..de8a5869 100644 --- a/src/pkgcore/repository/prototype.py +++ b/src/pkgcore/repository/prototype.py @@ -9,13 +9,13 @@ __all__ = ( import os from snakeoil.klass import jit_attr -from snakeoil.mappings import LazyValDict, DictMixin +from snakeoil.mappings import DictMixin, LazyValDict from snakeoil.osutils import pjoin from snakeoil.sequences import iflatten_instance from ..ebuild.atom import atom from ..operations import repo -from ..restrictions import values, boolean, restriction, packages +from ..restrictions import boolean, packages, restriction, values from ..restrictions.util import collect_package_restrictions diff --git a/src/pkgcore/repository/virtual.py b/src/pkgcore/repository/virtual.py index 0dc5e0ab..f36d7a1e 100644 --- a/src/pkgcore/repository/virtual.py +++ b/src/pkgcore/repository/virtual.py @@ -9,10 +9,10 @@ from snakeoil.sequences import stable_unique from ..ebuild import atom from ..ebuild.conditionals import DepSet -from ..package import virtual from ..package import base as pkg_base -from . import prototype +from ..package import virtual from ..restrictions.boolean import OrRestriction +from . import prototype class tree(prototype.tree): diff --git a/src/pkgcore/repository/wrapper.py b/src/pkgcore/repository/wrapper.py index 07cd2dae..eebc7540 100644 --- a/src/pkgcore/repository/wrapper.py +++ b/src/pkgcore/repository/wrapper.py @@ -7,10 +7,10 @@ __all__ = ("tree",) # icky. # ~harring -from snakeoil.klass import GetAttrProxy, DirProxy +from snakeoil.klass import DirProxy, GetAttrProxy from ..operations import repo -from . import prototype, errors +from . import errors, prototype class tree(prototype.tree): diff --git a/src/pkgcore/resolver/plan.py b/src/pkgcore/resolver/plan.py index 539bb3a2..9b9dd0d2 100644 --- a/src/pkgcore/resolver/plan.py +++ b/src/pkgcore/resolver/plan.py @@ -1,20 +1,20 @@ __all__ = ("resolver_frame", "resolver_stack", "merge_plan") -from collections import deque -from functools import partial import operator -from itertools import chain, islice, filterfalse import sys +from collections import deque +from functools import partial +from itertools import chain, filterfalse, islice from snakeoil.compatibility import cmp, sort_cmp from snakeoil.iterables import caching_iter # XXX: hack; see insert_blockers from ..ebuild import atom as _atom -from ..repository import misc, multiplex, filtered, util +from ..repository import filtered, misc, multiplex, util +from ..restrictions import packages, restriction, values from . import state from .choice_point import choice_point -from ..restrictions import packages, values, restriction limiters = set(["cycle"]) diff --git a/src/pkgcore/restrictions/boolean.py b/src/pkgcore/restrictions/boolean.py index a247a5cb..e15cf39a 100644 --- a/src/pkgcore/restrictions/boolean.py +++ b/src/pkgcore/restrictions/boolean.py @@ -9,7 +9,7 @@ __all__ = ("AndRestriction", "OrRestriction") from itertools import islice -from snakeoil.klass import generic_equality, cached_hash +from snakeoil.klass import cached_hash, generic_equality from . import restriction diff --git a/src/pkgcore/restrictions/packages.py b/src/pkgcore/restrictions/packages.py index 56c51818..e623c2d3 100644 --- a/src/pkgcore/restrictions/packages.py +++ b/src/pkgcore/restrictions/packages.py @@ -2,12 +2,12 @@ restriction classes designed for package level matching """ -from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil import klass +from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil.klass import generic_equality, static_attrgetter -from . import restriction, boolean from ..log import logger +from . import boolean, restriction class PackageRestriction(restriction.base, metaclass=generic_equality): diff --git a/src/pkgcore/restrictions/util.py b/src/pkgcore/restrictions/util.py index a6271754..9be5991d 100644 --- a/src/pkgcore/restrictions/util.py +++ b/src/pkgcore/restrictions/util.py @@ -4,7 +4,7 @@ restriction related utilities from snakeoil.sequences import iflatten_func -from . import packages, boolean, restriction +from . import boolean, packages, restriction def _is_package_instance(inst): diff --git a/src/pkgcore/restrictions/values.py b/src/pkgcore/restrictions/values.py index f425490e..a2f1cc6d 100644 --- a/src/pkgcore/restrictions/values.py +++ b/src/pkgcore/restrictions/values.py @@ -11,7 +11,7 @@ import re from snakeoil.klass import generic_equality, reflective_hash from snakeoil.sequences import iflatten_instance -from . import restriction, boolean, packages +from . import boolean, packages, restriction class base(restriction.base): diff --git a/src/pkgcore/scripts/__init__.py b/src/pkgcore/scripts/__init__.py index a2a604d6..24cd6dfd 100755 --- a/src/pkgcore/scripts/__init__.py +++ b/src/pkgcore/scripts/__init__.py @@ -2,9 +2,9 @@ """Wrapper for running commandline scripts.""" -from importlib import import_module import os import sys +from importlib import import_module def run(script_name): diff --git a/src/pkgcore/scripts/pclean.py b/src/pkgcore/scripts/pclean.py index 66397260..3f8f01ab 100644 --- a/src/pkgcore/scripts/pclean.py +++ b/src/pkgcore/scripts/pclean.py @@ -1,16 +1,16 @@ """system cleaning utility""" import argparse -from collections import defaultdict import errno -from functools import partial import glob -from itertools import chain import os import re import shutil import sys import time +from collections import defaultdict +from functools import partial +from itertools import chain from snakeoil.mappings import DictMixin from snakeoil.osutils import listdir_dirs, listdir_files, pjoin @@ -23,8 +23,8 @@ from ..repository import multiplex from ..repository.util import SimpleTree, get_virtual_repos from ..restrictions import boolean, packages from ..util import parserestrict -from ..util.commandline import ArgumentParser, StoreRepoObject, convert_to_restrict - +from ..util.commandline import (ArgumentParser, StoreRepoObject, + convert_to_restrict) argparser = ArgumentParser(description=__doc__, script=(__file__, __name__)) subparsers = argparser.add_subparsers(description='cleaning applets') diff --git a/src/pkgcore/scripts/pconfig.py b/src/pkgcore/scripts/pconfig.py index 703ceb64..92f30d2d 100644 --- a/src/pkgcore/scripts/pconfig.py +++ b/src/pkgcore/scripts/pconfig.py @@ -8,13 +8,13 @@ __all__ = ( "dump_uncollapsed", "dump_uncollapsed_main" ) -from functools import partial import textwrap import traceback +from functools import partial from snakeoil.errors import dump_error -from ..config import errors, basics +from ..config import basics, errors from ..ebuild import atom from ..plugin import get_plugins from ..util import commandline diff --git a/src/pkgcore/scripts/pebuild.py b/src/pkgcore/scripts/pebuild.py index 4c6c19d4..f983a87e 100644 --- a/src/pkgcore/scripts/pebuild.py +++ b/src/pkgcore/scripts/pebuild.py @@ -5,11 +5,10 @@ import sys from snakeoil.cli.exceptions import ExitException from snakeoil.strings import pluralism -from ..operations import observer, OperationError +from ..operations import OperationError, observer from ..package.errors import MetadataException from ..util.commandline import ArgumentParser, StoreTarget - argparser = ArgumentParser(description=__doc__, script=(__file__, __name__)) argparser.add_argument( 'target', action=StoreTarget, diff --git a/src/pkgcore/scripts/pinspect.py b/src/pkgcore/scripts/pinspect.py index 27e6f496..e668fd5f 100644 --- a/src/pkgcore/scripts/pinspect.py +++ b/src/pkgcore/scripts/pinspect.py @@ -35,7 +35,6 @@ from ..package import errors from ..restrictions import packages from ..util import commandline - pkgcore_opts = commandline.ArgumentParser(domain=False, script=(__file__, __name__)) argparser = commandline.ArgumentParser( suppress=True, description=__doc__, parents=(pkgcore_opts,)) diff --git a/src/pkgcore/scripts/pmaint.py b/src/pkgcore/scripts/pmaint.py index 814d5351..9853b134 100644 --- a/src/pkgcore/scripts/pmaint.py +++ b/src/pkgcore/scripts/pmaint.py @@ -5,32 +5,33 @@ __all__ = ( "perl_rebuild", "perl_rebuild_main", "env_update", "env_update_main", ) -from multiprocessing import cpu_count import os import re import textwrap import time +from multiprocessing import cpu_count from snakeoil.cli import arghparse from snakeoil.contexts import patch from snakeoil.fileutils import AtomicWriteFile -from snakeoil.osutils import pjoin, listdir_dirs +from snakeoil.osutils import listdir_dirs, pjoin from snakeoil.sequences import iter_stable_unique from ..cache.flat_hash import md5_cache -from ..ebuild import triggers, repository as ebuild_repo +from ..ebuild import repository as ebuild_repo +from ..ebuild import triggers from ..ebuild.cpv import CPV from ..exceptions import PkgcoreUserException from ..fs import contents, livefs from ..merge import triggers as merge_triggers -from ..operations import observer as observer_mod, OperationError +from ..operations import OperationError +from ..operations import observer as observer_mod from ..package import mutated from ..package.errors import MetadataException from ..restrictions import packages from ..util import commandline from ..util.parserestrict import parse_match - pkgcore_opts = commandline.ArgumentParser(domain=False, script=(__file__, __name__)) argparser = commandline.ArgumentParser( suppress=True, description=__doc__, parents=(pkgcore_opts,)) diff --git a/src/pkgcore/scripts/pmerge.py b/src/pkgcore/scripts/pmerge.py index 38f753ac..19129165 100644 --- a/src/pkgcore/scripts/pmerge.py +++ b/src/pkgcore/scripts/pmerge.py @@ -8,10 +8,10 @@ source or binary packages. # more should be doc'd... __all__ = ("AmbiguousQuery", "NoMatches") -from functools import partial import sys -from time import time +from functools import partial from textwrap import dedent +from time import time from snakeoil.cli.exceptions import ExitException from snakeoil.sequences import iflatten_instance, stable_unique @@ -21,7 +21,7 @@ from ..ebuild import resolver, restricts from ..ebuild.atom import atom from ..ebuild.misc import run_sanity_checks from ..merge import errors as merge_errors -from ..operations import observer, format +from ..operations import format, observer from ..repository.util import get_raw_repos from ..repository.virtual import RestrictionRepo from ..resolver.util import reduce_to_failures @@ -29,7 +29,6 @@ from ..restrictions import packages from ..restrictions.boolean import OrRestriction from ..util import commandline, parserestrict - argparser = commandline.ArgumentParser( domain=True, description=__doc__, script=(__file__, __name__)) argparser.add_argument( diff --git a/src/pkgcore/scripts/pquery.py b/src/pkgcore/scripts/pquery.py index 762230cb..f4d3d7b1 100644 --- a/src/pkgcore/scripts/pquery.py +++ b/src/pkgcore/scripts/pquery.py @@ -14,8 +14,8 @@ running them on source repos makes no sense. """ import errno -from functools import partial import os +from functools import partial from snakeoil.cli import arghparse from snakeoil.formatters import decorate_forced_wrapping @@ -23,12 +23,14 @@ from snakeoil.osutils import pjoin, sizeof_fmt from snakeoil.sequences import iter_stable_unique from .. import const -from ..ebuild import conditionals, atom +from ..ebuild import atom, conditionals from ..fs import fs as fs_module from ..repository import multiplex from ..repository.util import get_raw_repos, get_virtual_repos -from ..restrictions import packages, values, boolean -from ..util import commandline, parserestrict, packages as pkgutils +from ..restrictions import boolean, packages, values +from ..util import commandline +from ..util import packages as pkgutils +from ..util import parserestrict class DataSourceRestriction(values.base): diff --git a/src/pkgcore/scripts/pshowkw.py b/src/pkgcore/scripts/pshowkw.py index ed5c6979..439e0d7f 100644 --- a/src/pkgcore/scripts/pshowkw.py +++ b/src/pkgcore/scripts/pshowkw.py @@ -1,14 +1,14 @@ """display package keywords""" -from functools import partial import os +from functools import partial from snakeoil.strings import pluralism as _pl from .._vendor.tabulate import tabulate, tabulate_formats from ..ebuild import restricts -from ..util import commandline, packages as pkgutils - +from ..util import commandline +from ..util import packages as pkgutils argparser = commandline.ArgumentParser(description=__doc__, script=(__file__, __name__)) argparser.add_argument( diff --git a/src/pkgcore/sync/bzr.py b/src/pkgcore/sync/bzr.py index f611acf6..bc6c703f 100644 --- a/src/pkgcore/sync/bzr.py +++ b/src/pkgcore/sync/bzr.py @@ -3,6 +3,7 @@ __all__ = ("bzr_syncer",) import os from snakeoil.process.spawn import spawn_get_output + from . import base diff --git a/src/pkgcore/sync/http.py b/src/pkgcore/sync/http.py index 60bc101b..0882ff45 100644 --- a/src/pkgcore/sync/http.py +++ b/src/pkgcore/sync/http.py @@ -9,8 +9,8 @@ import urllib.request from snakeoil.fileutils import AtomicWriteFile, readfile_ascii from snakeoil.osutils import pjoin -from . import base from ..log import logger +from . import base class http_syncer(base.Syncer): diff --git a/src/pkgcore/sync/tar.py b/src/pkgcore/sync/tar.py index b05c94d0..da7927c3 100644 --- a/src/pkgcore/sync/tar.py +++ b/src/pkgcore/sync/tar.py @@ -1,11 +1,11 @@ __all__ = ("tar_syncer",) import atexit -from functools import partial import os import shutil import tempfile import uuid +from functools import partial from snakeoil.osutils import ensure_dirs diff --git a/src/pkgcore/system/libtool.py b/src/pkgcore/system/libtool.py index f81739b5..55b4d56e 100644 --- a/src/pkgcore/system/libtool.py +++ b/src/pkgcore/system/libtool.py @@ -1,14 +1,14 @@ __all__ = ("UnknownData", "FixLibtoolArchivesTrigger") +import re from functools import partial from os.path import basename, dirname -import re from snakeoil.currying import post_curry from snakeoil.sequences import stable_unique -from ..merge import triggers from ..exceptions import PkgcoreException +from ..merge import triggers x11_sub = post_curry(partial( re.compile(r"X11R6/+lib").sub, "lib"), 1) @@ -111,7 +111,7 @@ def rewrite_lafile(handle, filename): return True, template % {"content":content, "file":filename} def fix_fsobject(location): - from ..fs import livefs, fs + from ..fs import fs, livefs for obj in livefs.iter_scan(location): if not fs.isreg(obj) or not obj.basename.endswith(".la"): continue diff --git a/src/pkgcore/test/scripts/helpers.py b/src/pkgcore/test/scripts/helpers.py index 8393f0b3..61944b64 100644 --- a/src/pkgcore/test/scripts/helpers.py +++ b/src/pkgcore/test/scripts/helpers.py @@ -3,7 +3,7 @@ from snakeoil.cli import arghparse from snakeoil.test import argparse_helpers -from ...config import central, basics +from ...config import basics, central from ...config.hint import ConfigHint diff --git a/src/pkgcore/util/commandline.py b/src/pkgcore/util/commandline.py index bf96aa6c..6243e931 100644 --- a/src/pkgcore/util/commandline.py +++ b/src/pkgcore/util/commandline.py @@ -14,15 +14,15 @@ __all__ = ( ) import argparse -from functools import partial -from importlib import import_module import os import sys +from functools import partial +from importlib import import_module from snakeoil import modules from snakeoil.cli import arghparse, tool from snakeoil.log import suppress_logging -from snakeoil.osutils import pjoin, abspath, normpath +from snakeoil.osutils import abspath, normpath, pjoin from snakeoil.sequences import iflatten_instance, unstable_unique from snakeoil.strings import pluralism diff --git a/src/pkgcore/util/thread_pool.py b/src/pkgcore/util/thread_pool.py index cb84b4b8..5c2aab6c 100644 --- a/src/pkgcore/util/thread_pool.py +++ b/src/pkgcore/util/thread_pool.py @@ -1,11 +1,11 @@ +import queue +import threading from collections import deque from multiprocessing import cpu_count -import threading from types import GeneratorType -import queue -from snakeoil.compatibility import IGNORED_EXCEPTIONS from snakeoil import klass +from snakeoil.compatibility import IGNORED_EXCEPTIONS def reclaim_threads(threads): diff --git a/src/pkgcore/vdb/contents.py b/src/pkgcore/vdb/contents.py index ca6aa9cd..ac10dff2 100644 --- a/src/pkgcore/vdb/contents.py +++ b/src/pkgcore/vdb/contents.py @@ -7,7 +7,7 @@ from snakeoil import data_source from snakeoil.chksum import get_handler from snakeoil.fileutils import AtomicWriteFile, readlines_utf8 -from .. import os_data +from .. import os_data from ..fs import fs from ..fs.contents import contentsSet diff --git a/src/pkgcore/vdb/ondisk.py b/src/pkgcore/vdb/ondisk.py index 6db84b98..e8455134 100644 --- a/src/pkgcore/vdb/ondisk.py +++ b/src/pkgcore/vdb/ondisk.py @@ -1,9 +1,9 @@ __all__ = ("tree", "ConfiguredTree") import errno -from functools import partial import os import stat +from functools import partial from snakeoil import data_source from snakeoil.fileutils import readfile diff --git a/src/pkgcore/vdb/repo_ops.py b/src/pkgcore/vdb/repo_ops.py index 74ac8211..d66f8c6f 100644 --- a/src/pkgcore/vdb/repo_ops.py +++ b/src/pkgcore/vdb/repo_ops.py @@ -1,13 +1,13 @@ __all__ = ("install", "uninstall", "replace", "operations") -from itertools import chain import os import shutil import time +from itertools import chain from snakeoil import compression from snakeoil.data_source import local_source -from snakeoil.osutils import ensure_dirs, pjoin, normpath +from snakeoil.osutils import ensure_dirs, normpath, pjoin from snakeoil.version import get_version from .. import __title__ diff --git a/tests/module/cache/test_base.py b/tests/module/cache/test_base.py index a4d50e79..9af465fd 100644 --- a/tests/module/cache/test_base.py +++ b/tests/module/cache/test_base.py @@ -1,10 +1,10 @@ import operator from snakeoil.chksum import LazilyHashedPath - -from pkgcore.cache import base, errors, bulk from snakeoil.test import TestCase +from pkgcore.cache import base, bulk, errors + def _mk_chf_obj(**kwargs): kwargs.setdefault('mtime', 100) diff --git a/tests/module/config/test_basics.py b/tests/module/config/test_basics.py index 2bd7d993..412ff5ea 100644 --- a/tests/module/config/test_basics.py +++ b/tests/module/config/test_basics.py @@ -1,10 +1,11 @@ import os import tempfile -from pkgcore.config import basics, errors, central -from pkgcore.config.hint import ConfigHint, configurable from snakeoil.test import TestCase +from pkgcore.config import basics, central, errors +from pkgcore.config.hint import ConfigHint, configurable + def passthrough(*args, **kwargs): return args, kwargs diff --git a/tests/module/config/test_central.py b/tests/module/config/test_central.py index 410e6da0..9c824a94 100644 --- a/tests/module/config/test_central.py +++ b/tests/module/config/test_central.py @@ -1,7 +1,7 @@ from snakeoil.errors import walk_exception_chain from snakeoil.test import TestCase -from pkgcore.config import central, basics, errors +from pkgcore.config import basics, central, errors from pkgcore.config.hint import configurable diff --git a/tests/module/config/test_cparser.py b/tests/module/config/test_cparser.py index dfd5029d..e3851a35 100644 --- a/tests/module/config/test_cparser.py +++ b/tests/module/config/test_cparser.py @@ -1,9 +1,10 @@ -from io import StringIO import sys +from io import StringIO -from pkgcore.config import cparser, central, errors from snakeoil.test import TestCase +from pkgcore.config import central, cparser, errors + class CaseSensitiveConfigParserTest(TestCase): diff --git a/tests/module/config/test_init.py b/tests/module/config/test_init.py index 9ba1600c..99e7e7a4 100644 --- a/tests/module/config/test_init.py +++ b/tests/module/config/test_init.py @@ -5,7 +5,7 @@ import operator from snakeoil.test import TestCase from snakeoil.test.mixins import mk_named_tempfile -from pkgcore.config import load_config, basics +from pkgcore.config import basics, load_config from pkgcore.config.hint import configurable diff --git a/tests/module/ebuild/test_cpv.py b/tests/module/ebuild/test_cpv.py index 614241e0..ccfe4279 100644 --- a/tests/module/ebuild/test_cpv.py +++ b/tests/module/ebuild/test_cpv.py @@ -5,6 +5,7 @@ from snakeoil.compatibility import cmp from pkgcore.ebuild import cpv + def generate_misc_sufs(): simple_good_sufs = ["_alpha", "_beta", "_pre", "_p"] suf_nums = list(range(100)) diff --git a/tests/module/ebuild/test_eapi.py b/tests/module/ebuild/test_eapi.py index 33c0c4df..e0ab82d7 100644 --- a/tests/module/ebuild/test_eapi.py +++ b/tests/module/ebuild/test_eapi.py @@ -1,11 +1,11 @@ from importlib import reload from unittest import mock -from pkgcore.ebuild import eapi -from pkgcore.ebuild.eapi import EAPI, get_eapi, eapi6 - import pytest +from pkgcore.ebuild import eapi +from pkgcore.ebuild.eapi import EAPI, eapi6, get_eapi + def test_get_eapi(): # unknown EAPI diff --git a/tests/module/ebuild/test_ebuild_src.py b/tests/module/ebuild/test_ebuild_src.py index 54325bc5..3d4875d8 100644 --- a/tests/module/ebuild/test_ebuild_src.py +++ b/tests/module/ebuild/test_ebuild_src.py @@ -1,15 +1,15 @@ -from functools import partial import os import textwrap +from functools import partial +import pytest from snakeoil.currying import post_curry from snakeoil.data_source import data_source, local_source from snakeoil.osutils import pjoin -import pytest from pkgcore import fetch -from pkgcore.ebuild import ebuild_src, digest, repo_objs -from pkgcore.ebuild.eapi import get_eapi, EAPI +from pkgcore.ebuild import digest, ebuild_src, repo_objs +from pkgcore.ebuild.eapi import EAPI, get_eapi from pkgcore.package import errors from pkgcore.test import malleable_obj diff --git a/tests/module/ebuild/test_filter_env.py b/tests/module/ebuild/test_filter_env.py index e31fffe1..77db44be 100644 --- a/tests/module/ebuild/test_filter_env.py +++ b/tests/module/ebuild/test_filter_env.py @@ -1,5 +1,5 @@ -from functools import partial import io +from functools import partial from snakeoil.test import TestCase diff --git a/tests/module/ebuild/test_formatter.py b/tests/module/ebuild/test_formatter.py index 197c3662..800197ba 100644 --- a/tests/module/ebuild/test_formatter.py +++ b/tests/module/ebuild/test_formatter.py @@ -1,11 +1,12 @@ import difflib from snakeoil.test import TestCase -from snakeoil.test.argparse_helpers import FakeStreamFormatter, Color, Reset, Bold +from snakeoil.test.argparse_helpers import (Bold, Color, FakeStreamFormatter, + Reset) from pkgcore.ebuild.atom import atom -from pkgcore.ebuild.formatter import ( - BasicFormatter, PkgcoreFormatter, PortageFormatter, PaludisFormatter) +from pkgcore.ebuild.formatter import (BasicFormatter, PaludisFormatter, + PkgcoreFormatter, PortageFormatter) from pkgcore.test.misc import FakePkg, FakeRepo diff --git a/tests/module/ebuild/test_portage_conf.py b/tests/module/ebuild/test_portage_conf.py index 725a40d5..1997825e 100644 --- a/tests/module/ebuild/test_portage_conf.py +++ b/tests/module/ebuild/test_portage_conf.py @@ -2,14 +2,15 @@ import binascii import os import shutil import stat -from tempfile import NamedTemporaryFile import textwrap +from tempfile import NamedTemporaryFile from snakeoil.osutils import pjoin from snakeoil.test import TestCase from snakeoil.test.mixins import TempDirMixin -from pkgcore import const, exceptions as base_errors +from pkgcore import const +from pkgcore import exceptions as base_errors from pkgcore.config import errors as config_errors from pkgcore.ebuild.portage_conf import PortageConfig diff --git a/tests/module/ebuild/test_profiles.py b/tests/module/ebuild/test_profiles.py index 13de1261..00fcd780 100644 --- a/tests/module/ebuild/test_profiles.py +++ b/tests/module/ebuild/test_profiles.py @@ -1,12 +1,12 @@ import binascii import errno -from functools import partial import os import shutil import tempfile +from functools import partial from unittest import mock -from snakeoil.osutils import pjoin, ensure_dirs, normpath +from snakeoil.osutils import ensure_dirs, normpath, pjoin from snakeoil.test import TestCase from snakeoil.test.mixins import TempDirMixin diff --git a/tests/module/ebuild/test_repo_objs.py b/tests/module/ebuild/test_repo_objs.py index de45bb17..9c5899f2 100644 --- a/tests/module/ebuild/test_repo_objs.py +++ b/tests/module/ebuild/test_repo_objs.py @@ -7,7 +7,7 @@ from snakeoil.data_source import data_source from snakeoil.fileutils import touch from snakeoil.mappings import ImmutableDict -from pkgcore.ebuild import repo_objs, atom +from pkgcore.ebuild import atom, repo_objs from pkgcore.repository import errors as repo_errors diff --git a/tests/module/ebuild/test_repository.py b/tests/module/ebuild/test_repository.py index 22663f1b..9a91b97b 100644 --- a/tests/module/ebuild/test_repository.py +++ b/tests/module/ebuild/test_repository.py @@ -6,8 +6,9 @@ from snakeoil.fileutils import touch from snakeoil.osutils import ensure_dirs, pjoin from snakeoil.test.mixins import TempDirMixin +from pkgcore.ebuild import eclass_cache from pkgcore.ebuild import errors as ebuild_errors -from pkgcore.ebuild import repository, restricts, eclass_cache +from pkgcore.ebuild import repository, restricts from pkgcore.ebuild.atom import atom from pkgcore.repository import errors diff --git a/tests/module/fetch/test_base.py b/tests/module/fetch/test_base.py index 1f1c13d3..e6a7459f 100644 --- a/tests/module/fetch/test_base.py +++ b/tests/module/fetch/test_base.py @@ -1,11 +1,11 @@ -from functools import partial import os +from functools import partial +import pytest from snakeoil import data_source from snakeoil.chksum import get_handlers -import pytest -from pkgcore.fetch import base, fetchable, errors +from pkgcore.fetch import base, errors, fetchable repeating_str = 'asdf' data = repeating_str * 4000 @@ -13,6 +13,8 @@ handlers = get_handlers() from snakeoil.mappings import LazyValDict + + def _callback(chf): return handlers[chf](data_source.data_source(data)) chksums = LazyValDict(frozenset(handlers.keys()), _callback) diff --git a/tests/module/fs/test_contents.py b/tests/module/fs/test_contents.py index 9983341e..bffb9224 100644 --- a/tests/module/fs/test_contents.py +++ b/tests/module/fs/test_contents.py @@ -1,11 +1,11 @@ -from functools import partial import os +from functools import partial from snakeoil.currying import post_curry from snakeoil.osutils import pjoin from snakeoil.test import TestCase -from pkgcore.fs import fs, contents +from pkgcore.fs import contents, fs mk_file = partial(fs.fsFile, strict=False) mk_dir = partial(fs.fsDir, strict=False) diff --git a/tests/module/fs/test_fs.py b/tests/module/fs/test_fs.py index 55f41804..a4c55b07 100644 --- a/tests/module/fs/test_fs.py +++ b/tests/module/fs/test_fs.py @@ -2,7 +2,7 @@ import os from snakeoil.chksum import get_chksums from snakeoil.data_source import data_source -from snakeoil.osutils import pjoin, normpath +from snakeoil.osutils import normpath, pjoin from snakeoil.test import TestCase from snakeoil.test.mixins import tempdir_decorator diff --git a/tests/module/fs/test_ops.py b/tests/module/fs/test_ops.py index 0f9c99b2..038548ea 100644 --- a/tests/module/fs/test_ops.py +++ b/tests/module/fs/test_ops.py @@ -7,7 +7,7 @@ from snakeoil.osutils import pjoin from snakeoil.test import TestCase from snakeoil.test.mixins import TempDirMixin -from pkgcore.fs import ops, fs, livefs, contents +from pkgcore.fs import contents, fs, livefs, ops class VerifyMixin: diff --git a/tests/module/merge/test_engine.py b/tests/module/merge/test_engine.py index c262acde..16e29cab 100644 --- a/tests/module/merge/test_engine.py +++ b/tests/module/merge/test_engine.py @@ -8,8 +8,8 @@ from pkgcore.fs import livefs from pkgcore.fs.contents import contentsSet from pkgcore.merge import engine +from ..fs.fs_util import fsDir, fsFile, fsSymlink from .util import fake_engine -from ..fs.fs_util import fsFile, fsDir, fsSymlink class fake_pkg: diff --git a/tests/module/merge/test_triggers.py b/tests/module/merge/test_triggers.py index 4d5a2230..241b6e63 100644 --- a/tests/module/merge/test_triggers.py +++ b/tests/module/merge/test_triggers.py @@ -1,22 +1,21 @@ -from functools import partial - -from math import floor, ceil import os import shutil import time +from functools import partial +from math import ceil, floor import pytest from snakeoil import process from snakeoil.currying import post_curry -from snakeoil.osutils import pjoin, ensure_dirs, normpath -from snakeoil.test import mixins, TestCase +from snakeoil.osutils import ensure_dirs, normpath, pjoin +from snakeoil.test import TestCase, mixins from pkgcore.fs import fs -from pkgcore.merge import triggers, const from pkgcore.fs.contents import contentsSet from pkgcore.fs.livefs import gen_obj, scan +from pkgcore.merge import const, triggers -from .util import fake_trigger, fake_engine, fake_reporter +from .util import fake_engine, fake_reporter, fake_trigger def _render_msg(func, msg, *args, **kwargs): diff --git a/tests/module/package/test_base.py b/tests/module/package/test_base.py index 4a577066..63dab2f3 100644 --- a/tests/module/package/test_base.py +++ b/tests/module/package/test_base.py @@ -1,8 +1,9 @@ from functools import partial +from snakeoil.test import TestCase + from pkgcore.package import base from pkgcore.test import malleable_obj -from snakeoil.test import TestCase def fake_pkg(cat='dev-util', pkg='bsdiff', ver='1.0', **attrs): diff --git a/tests/module/package/test_metadata.py b/tests/module/package/test_metadata.py index 807ba9a9..a697d411 100644 --- a/tests/module/package/test_metadata.py +++ b/tests/module/package/test_metadata.py @@ -1,6 +1,7 @@ -from pkgcore.package import metadata, base from snakeoil.test import TestCase +from pkgcore.package import base, metadata + def make_pkg_kls(attrs=(), callbacks={}): diff --git a/tests/module/pkgsets/test_filelist.py b/tests/module/pkgsets/test_filelist.py index 98d8cdf0..216bb440 100644 --- a/tests/module/pkgsets/test_filelist.py +++ b/tests/module/pkgsets/test_filelist.py @@ -1,11 +1,12 @@ import os import tempfile +from snakeoil.test import TestCase + from pkgcore import log, os_data from pkgcore.ebuild.atom import atom from pkgcore.pkgsets import filelist -from pkgcore.test import protect_logging, callback_logger -from snakeoil.test import TestCase +from pkgcore.test import callback_logger, protect_logging class TestFileList(TestCase): diff --git a/tests/module/repository/test_filtered.py b/tests/module/repository/test_filtered.py index f31db3c9..083ec93d 100644 --- a/tests/module/repository/test_filtered.py +++ b/tests/module/repository/test_filtered.py @@ -1,8 +1,8 @@ from pkgcore.ebuild.atom import atom from pkgcore.ebuild.cpv import VersionedCPV from pkgcore.repository import filtered -from pkgcore.restrictions import packages, values from pkgcore.repository.util import SimpleTree +from pkgcore.restrictions import packages, values class TestVisibility: diff --git a/tests/module/repository/test_prototype.py b/tests/module/repository/test_prototype.py index c6bc899a..4e92c7b3 100644 --- a/tests/module/repository/test_prototype.py +++ b/tests/module/repository/test_prototype.py @@ -9,7 +9,7 @@ from pkgcore.ebuild.cpv import VersionedCPV from pkgcore.operations.repo import operations from pkgcore.package.mutated import MutatedPkg from pkgcore.repository.util import SimpleTree -from pkgcore.restrictions import packages, values, boolean +from pkgcore.restrictions import boolean, packages, values from pkgcore.test import malleable_obj diff --git a/tests/module/resolver/test_choice_point.py b/tests/module/resolver/test_choice_point.py index 5d27cd45..1544304f 100644 --- a/tests/module/resolver/test_choice_point.py +++ b/tests/module/resolver/test_choice_point.py @@ -1,6 +1,7 @@ +from snakeoil.test import TestCase + from pkgcore.resolver.choice_point import choice_point from pkgcore.restrictions.boolean import AndRestriction, OrRestriction -from snakeoil.test import TestCase class fake_package: diff --git a/tests/module/resolver/test_pigeonholes.py b/tests/module/resolver/test_pigeonholes.py index 817f8554..1238b473 100644 --- a/tests/module/resolver/test_pigeonholes.py +++ b/tests/module/resolver/test_pigeonholes.py @@ -1,6 +1,7 @@ +from snakeoil.test import TestCase + from pkgcore.resolver.pigeonholes import PigeonHoledSlots from pkgcore.restrictions import restriction -from snakeoil.test import TestCase from .test_choice_point import fake_package diff --git a/tests/module/restrictions/test_boolean.py b/tests/module/restrictions/test_boolean.py index c6b561d1..5f998f04 100644 --- a/tests/module/restrictions/test_boolean.py +++ b/tests/module/restrictions/test_boolean.py @@ -1,6 +1,7 @@ -from pkgcore.restrictions import boolean, restriction from snakeoil.test import TestCase +from pkgcore.restrictions import boolean, restriction + true = restriction.AlwaysBool(node_type='foo', negate=True) false = restriction.AlwaysBool(node_type='foo', negate=False) diff --git a/tests/module/restrictions/test_packages.py b/tests/module/restrictions/test_packages.py index fbaf792c..b716073e 100644 --- a/tests/module/restrictions/test_packages.py +++ b/tests/module/restrictions/test_packages.py @@ -2,8 +2,8 @@ from snakeoil.mappings import AttrAccessible from pkgcore import log from pkgcore.restrictions import packages, values -from pkgcore.test import ( - silence_logging, TestRestriction, TestCase, malleable_obj, callback_logger) +from pkgcore.test import (TestCase, TestRestriction, callback_logger, + malleable_obj, silence_logging) class AlwaysSelfIntersect(values.base): diff --git a/tests/module/restrictions/test_util.py b/tests/module/restrictions/test_util.py index 472256ae..5e125d7e 100644 --- a/tests/module/restrictions/test_util.py +++ b/tests/module/restrictions/test_util.py @@ -1,6 +1,7 @@ -from pkgcore.restrictions import util, packages, values from snakeoil.test import TestCase +from pkgcore.restrictions import packages, util, values + class Test_collect_package_restrictions(TestCase): diff --git a/tests/module/restrictions/test_values.py b/tests/module/restrictions/test_values.py index edab45cc..2571f45d 100644 --- a/tests/module/restrictions/test_values.py +++ b/tests/module/restrictions/test_values.py @@ -1,6 +1,7 @@ +from snakeoil.test import TestCase + from pkgcore.restrictions import values from pkgcore.test import TestRestriction -from snakeoil.test import TestCase class SillyBool(values.base): diff --git a/tests/module/scripts/test_pclean.py b/tests/module/scripts/test_pclean.py index 800ce10d..e776dea8 100644 --- a/tests/module/scripts/test_pclean.py +++ b/tests/module/scripts/test_pclean.py @@ -1,6 +1,7 @@ +from snakeoil.test import TestCase + from pkgcore.scripts import pclean from pkgcore.test.scripts.helpers import ArgParseMixin -from snakeoil.test import TestCase class CommandlineTest(TestCase, ArgParseMixin): diff --git a/tests/module/scripts/test_pclonecache.py b/tests/module/scripts/test_pclonecache.py index a0eb126a..332f1177 100644 --- a/tests/module/scripts/test_pclonecache.py +++ b/tests/module/scripts/test_pclonecache.py @@ -1,8 +1,9 @@ +from snakeoil.test import TestCase + from pkgcore.config import basics from pkgcore.config.hint import ConfigHint from pkgcore.scripts import pclonecache from pkgcore.test.scripts.helpers import ArgParseMixin -from snakeoil.test import TestCase class Cache: diff --git a/tests/module/scripts/test_pconfig.py b/tests/module/scripts/test_pconfig.py index 46050e8a..b4fc544e 100644 --- a/tests/module/scripts/test_pconfig.py +++ b/tests/module/scripts/test_pconfig.py @@ -1,7 +1,7 @@ import sys -from snakeoil.test import TestCase import pytest +from snakeoil.test import TestCase from pkgcore.config import basics, errors from pkgcore.config.hint import configurable diff --git a/tests/module/scripts/test_pebuild.py b/tests/module/scripts/test_pebuild.py index e41ea206..4419c66c 100644 --- a/tests/module/scripts/test_pebuild.py +++ b/tests/module/scripts/test_pebuild.py @@ -1,11 +1,11 @@ +from snakeoil.test import TestCase + from pkgcore.config import basics from pkgcore.config.hint import ConfigHint, configurable from pkgcore.scripts import pebuild from pkgcore.test.misc import FakePkg, FakeRepo from pkgcore.test.scripts.helpers import ArgParseMixin -from snakeoil.test import TestCase - class FakeDomain: diff --git a/tests/module/scripts/test_pmaint.py b/tests/module/scripts/test_pmaint.py index 59079dca..75cb0557 100644 --- a/tests/module/scripts/test_pmaint.py +++ b/tests/module/scripts/test_pmaint.py @@ -8,14 +8,12 @@ from snakeoil.test import TestCase from pkgcore.config import basics from pkgcore.config.hint import ConfigHint, configurable from pkgcore.ebuild.cpv import CPV -from pkgcore.operations.repo import install, uninstall, replace, operations -from pkgcore.repository import util, syncable +from pkgcore.operations.repo import install, operations, replace, uninstall +from pkgcore.repository import syncable, util from pkgcore.scripts import pmaint from pkgcore.sync import base from pkgcore.test.scripts.helpers import ArgParseMixin - - Options = AttrAccessible diff --git a/tests/module/scripts/test_pmerge.py b/tests/module/scripts/test_pmerge.py index d62fa1e5..48c32a7a 100644 --- a/tests/module/scripts/test_pmerge.py +++ b/tests/module/scripts/test_pmerge.py @@ -3,8 +3,8 @@ import pytest from pkgcore.ebuild.atom import atom from pkgcore.repository.util import SimpleTree from pkgcore.scripts import pmerge -from pkgcore.util.parserestrict import parse_match from pkgcore.test.misc import FakePkg, FakeRepo +from pkgcore.util.parserestrict import parse_match # TODO: make repo objs into configurable fixtures diff --git a/tests/module/scripts/test_pplugincache.py b/tests/module/scripts/test_pplugincache.py index cd37e8d9..c194073c 100644 --- a/tests/module/scripts/test_pplugincache.py +++ b/tests/module/scripts/test_pplugincache.py @@ -1,7 +1,8 @@ +from snakeoil.test import TestCase + from pkgcore import plugins from pkgcore.scripts import pplugincache from pkgcore.test.scripts.helpers import ArgParseMixin -from snakeoil.test import TestCase class CommandlineTest(TestCase, ArgParseMixin): diff --git a/tests/module/scripts/test_pquery.py b/tests/module/scripts/test_pquery.py index 90e51ddb..eaae3e64 100644 --- a/tests/module/scripts/test_pquery.py +++ b/tests/module/scripts/test_pquery.py @@ -1,10 +1,11 @@ +from snakeoil.test import TestCase + from pkgcore.config import basics from pkgcore.config.hint import ConfigHint, configurable from pkgcore.ebuild import atom from pkgcore.repository import util from pkgcore.scripts import pquery from pkgcore.test.scripts.helpers import ArgParseMixin -from snakeoil.test import TestCase class FakeDomain: diff --git a/tests/module/scripts/test_pshowkw.py b/tests/module/scripts/test_pshowkw.py index 7cf7fbc7..0ccfcb76 100644 --- a/tests/module/scripts/test_pshowkw.py +++ b/tests/module/scripts/test_pshowkw.py @@ -5,7 +5,7 @@ from pkgcore.config.hint import ConfigHint, configurable from pkgcore.ebuild.repo_objs import RepoConfig from pkgcore.repository import multiplex from pkgcore.scripts import pshowkw -from pkgcore.test.misc import FakePkg, FakeEbuildRepo +from pkgcore.test.misc import FakeEbuildRepo, FakePkg from pkgcore.test.scripts.helpers import ArgParseMixin diff --git a/tests/module/test_plugin.py b/tests/module/test_plugin.py index ffb1b5ef..0e96980e 100644 --- a/tests/module/test_plugin.py +++ b/tests/module/test_plugin.py @@ -5,11 +5,12 @@ import sys import tempfile from unittest import mock -from pkgcore import plugin -from pkgcore.test import silence_logging from snakeoil.osutils import pjoin from snakeoil.sequences import stable_unique +from pkgcore import plugin +from pkgcore.test import silence_logging + class LowPlug: priority = 1 diff --git a/tests/module/util/test_parserestrict.py b/tests/module/util/test_parserestrict.py index 9ed0ebc9..d967d53a 100644 --- a/tests/module/util/test_parserestrict.py +++ b/tests/module/util/test_parserestrict.py @@ -1,10 +1,10 @@ -from snakeoil.currying import post_curry import pytest +from snakeoil.currying import post_curry from pkgcore.ebuild import restricts from pkgcore.ebuild.atom import atom from pkgcore.repository import util -from pkgcore.restrictions import packages, values, boolean, restriction +from pkgcore.restrictions import boolean, packages, restriction, values from pkgcore.util import parserestrict |