make most of pip relative imports

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2018-03-10 11:17:31 -05:00
parent 0c8f04f8b3
commit dadb372d61
16 changed files with 111 additions and 112 deletions
+9 -10
View File
@@ -22,14 +22,14 @@ from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
warnings.filterwarnings("ignore", category=DependencyWarning) # noqa
from pip.exceptions import InstallationError, CommandError, PipError
from pip.utils import get_installed_distributions, get_prog
from pip.utils import deprecation, dist_is_editable
from pip.vcs import git, mercurial, subversion, bazaar # noqa
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.commands import get_summaries, get_similar_commands
from pip.commands import commands_dict
from pip._vendor.requests.packages.urllib3.exceptions import (
from .exceptions import InstallationError, CommandError, PipError
from .utils import get_installed_distributions, get_prog
from .utils import deprecation, dist_is_editable
from .vcs import git, mercurial, subversion, bazaar # noqa
from .baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from .commands import get_summaries, get_similar_commands
from .commands import commands_dict
from ._vendor.requests.packages.urllib3.exceptions import (
InsecureRequestWarning,
)
@@ -39,8 +39,7 @@ from pip._vendor.requests.packages.urllib3.exceptions import (
# This fixes a peculiarity when importing via __import__ - as we are
# initialising the pip module, "from pip import cmdoptions" is recursive
# and appears not to work properly in that situation.
import pip.cmdoptions
cmdoptions = pip.cmdoptions
from . import cmdoptions
# The version as used in the setup.py and the docs conf.py
__version__ = "9.0.1"
+12 -12
View File
@@ -7,23 +7,23 @@ import sys
import optparse
import warnings
from pip import cmdoptions
from pip.index import PackageFinder
from pip.locations import running_under_virtualenv
from pip.download import PipSession
from pip.exceptions import (BadCommand, InstallationError, UninstallationError,
from . import cmdoptions
from .index import PackageFinder
from .locations import running_under_virtualenv
from .download import PipSession
from .exceptions import (BadCommand, InstallationError, UninstallationError,
CommandError, PreviousBuildDirError)
from pip.compat import logging_dictConfig
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.req import InstallRequirement, parse_requirements
from pip.status_codes import (
from .compat import logging_dictConfig
from .baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from .req import InstallRequirement, parse_requirements
from .status_codes import (
SUCCESS, ERROR, UNKNOWN_ERROR, VIRTUALENV_NOT_FOUND,
PREVIOUS_BUILD_DIR_ERROR,
)
from pip.utils import deprecation, get_prog, normalize_path
from pip.utils.logging import IndentingFormatter
from pip.utils.outdated import pip_version_check
from .utils import deprecation, get_prog, normalize_path
from .utils.logging import IndentingFormatter
from .utils.outdated import pip_version_check
__all__ = ['Command']
+12 -12
View File
@@ -3,18 +3,18 @@ Package containing all pip commands
"""
from __future__ import absolute_import
from pip.commands.completion import CompletionCommand
from pip.commands.download import DownloadCommand
from pip.commands.freeze import FreezeCommand
from pip.commands.hash import HashCommand
from pip.commands.help import HelpCommand
from pip.commands.list import ListCommand
from pip.commands.check import CheckCommand
from pip.commands.search import SearchCommand
from pip.commands.show import ShowCommand
from pip.commands.install import InstallCommand
from pip.commands.uninstall import UninstallCommand
from pip.commands.wheel import WheelCommand
from .completion import CompletionCommand
from .download import DownloadCommand
from .freeze import FreezeCommand
from .hash import HashCommand
from .help import HelpCommand
from .list import ListCommand
from .check import CheckCommand
from .search import SearchCommand
from .show import ShowCommand
from .install import InstallCommand
from .uninstall import UninstallCommand
from .wheel import WheelCommand
commands_dict = {
+3 -3
View File
@@ -1,8 +1,8 @@
import logging
from pip.basecommand import Command
from pip.operations.check import check_requirements
from pip.utils import get_installed_distributions
from ..basecommand import Command
from ..operations.check import check_requirements
from ..utils import get_installed_distributions
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -1,7 +1,7 @@
from __future__ import absolute_import
import sys
from pip.basecommand import Command
from ..basecommand import Command
BASE_COMPLETION = """
# pip %(shell)s completion start%(script)s# pip %(shell)s completion end
+8 -8
View File
@@ -3,14 +3,14 @@ from __future__ import absolute_import
import logging
import os
from pip.exceptions import CommandError
from pip.index import FormatControl
from pip.req import RequirementSet
from pip.basecommand import RequirementCommand
from pip import cmdoptions
from pip.utils import ensure_dir, normalize_path
from pip.utils.build import BuildDirectory
from pip.utils.filesystem import check_path_owner
from ..exceptions import CommandError
from ..index import FormatControl
from ..req import RequirementSet
from ..basecommand import RequirementCommand
from .. import cmdoptions
from ..utils import ensure_dir, normalize_path
from ..utils.build import BuildDirectory
from ..utils.filesystem import check_path_owner
logger = logging.getLogger(__name__)
+4 -4
View File
@@ -3,10 +3,10 @@ from __future__ import absolute_import
import sys
import pip
from pip.compat import stdlib_pkgs
from pip.basecommand import Command
from pip.operations.freeze import freeze
from pip.wheel import WheelCache
from ..compat import stdlib_pkgs
from ..basecommand import Command
from ..operations.freeze import freeze
from ..wheel import WheelCache
DEV_PKGS = ('pip', 'setuptools', 'distribute', 'wheel')
+4 -4
View File
@@ -4,10 +4,10 @@ import hashlib
import logging
import sys
from pip.basecommand import Command
from pip.status_codes import ERROR
from pip.utils import read_chunks
from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES
from ..basecommand import Command
from ..status_codes import ERROR
from ..utils import read_chunks
from ..utils.hashes import FAVORITE_HASH, STRONG_HASHES
logger = logging.getLogger(__name__)
+2 -2
View File
@@ -1,7 +1,7 @@
from __future__ import absolute_import
from pip.basecommand import Command, SUCCESS
from pip.exceptions import CommandError
from ..basecommand import Command, SUCCESS
from ..exceptions import CommandError
class HelpCommand(Command):
+10 -10
View File
@@ -11,18 +11,18 @@ try:
except ImportError:
wheel = None
from pip.req import RequirementSet
from pip.basecommand import RequirementCommand
from pip.locations import virtualenv_no_global, distutils_scheme
from pip.exceptions import (
from ..req import RequirementSet
from ..basecommand import RequirementCommand
from ..locations import virtualenv_no_global, distutils_scheme
from ..exceptions import (
InstallationError, CommandError, PreviousBuildDirError,
)
from pip import cmdoptions
from pip.utils import ensure_dir, get_installed_version
from pip.utils.build import BuildDirectory
from pip.utils.deprecation import RemovedInPip10Warning
from pip.utils.filesystem import check_path_owner
from pip.wheel import WheelCache, WheelBuilder
from .. import cmdoptions
from ..utils import ensure_dir, get_installed_version
from ..utils.build import BuildDirectory
from ..utils.deprecation import RemovedInPip10Warning
from ..utils.filesystem import check_path_owner
from ..wheel import WheelCache, WheelBuilder
logger = logging.getLogger(__name__)
+7 -7
View File
@@ -8,15 +8,15 @@ try:
except ImportError:
from itertools import izip_longest as zip_longest
from pip._vendor import six
from .._vendor import six
from pip.basecommand import Command
from pip.exceptions import CommandError
from pip.index import PackageFinder
from pip.utils import (
from ..basecommand import Command
from ..exceptions import CommandError
from ..index import PackageFinder
from ..utils import (
get_installed_distributions, dist_is_editable)
from pip.utils.deprecation import RemovedInPip10Warning
from pip.cmdoptions import make_option_group, index_group
from ..utils.deprecation import RemovedInPip10Warning
from ..cmdoptions import make_option_group, index_group
logger = logging.getLogger(__name__)
+11 -11
View File
@@ -4,17 +4,17 @@ import logging
import sys
import textwrap
from pip.basecommand import Command, SUCCESS
from pip.compat import OrderedDict
from pip.download import PipXmlrpcTransport
from pip.models import PyPI
from pip.utils import get_terminal_size
from pip.utils.logging import indent_log
from pip.exceptions import CommandError
from pip.status_codes import NO_MATCHES_FOUND
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor import pkg_resources
from pip._vendor.six.moves import xmlrpc_client
from ..basecommand import Command, SUCCESS
from ..compat import OrderedDict
from ..download import PipXmlrpcTransport
from ..models import PyPI
from ..utils import get_terminal_size
from ..utils.logging import indent_log
from ..exceptions import CommandError
from ..status_codes import NO_MATCHES_FOUND
from .._vendor.packaging.version import parse as parse_version
from .._vendor import pkg_resources
from .._vendor.six.moves import xmlrpc_client
logger = logging.getLogger(__name__)
+4 -4
View File
@@ -4,10 +4,10 @@ from email.parser import FeedParser
import logging
import os
from pip.basecommand import Command
from pip.status_codes import SUCCESS, ERROR
from pip._vendor import pkg_resources
from pip._vendor.packaging.utils import canonicalize_name
from ..basecommand import Command
from ..status_codes import SUCCESS, ERROR
from .._vendor import pkg_resources
from .._vendor.packaging.utils import canonicalize_name
logger = logging.getLogger(__name__)
+4 -4
View File
@@ -1,10 +1,10 @@
from __future__ import absolute_import
import pip
from pip.wheel import WheelCache
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.basecommand import Command
from pip.exceptions import InstallationError
from ..wheel import WheelCache
from ..req import InstallRequirement, RequirementSet, parse_requirements
from ..basecommand import Command
from ..exceptions import InstallationError
class UninstallCommand(Command):
+8 -8
View File
@@ -5,14 +5,14 @@ import logging
import os
import warnings
from pip.basecommand import RequirementCommand
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import RequirementSet
from pip.utils import import_or_raise
from pip.utils.build import BuildDirectory
from pip.utils.deprecation import RemovedInPip10Warning
from pip.wheel import WheelCache, WheelBuilder
from pip import cmdoptions
from ..basecommand import RequirementCommand
from ..exceptions import CommandError, PreviousBuildDirError
from ..req import RequirementSet
from ..utils import import_or_raise
from ..utils.build import BuildDirectory
from ..utils.deprecation import RemovedInPip10Warning
from ..wheel import WheelCache, WheelBuilder
from .. import cmdoptions
logger = logging.getLogger(__name__)
+12 -12
View File
@@ -5,25 +5,25 @@ from itertools import chain
import logging
import os
from pip._vendor import pkg_resources
from pip._vendor import requests
from pipenv.patched.pip._vendor import pkg_resources
from pipenv.patched.pip._vendor import requests
from pip.compat import expanduser
from pip.download import (is_file_url, is_dir_url, is_vcs_url, url_to_path,
from pipenv.patched.pip.compat import expanduser
from pipenv.patched.pip.download import (is_file_url, is_dir_url, is_vcs_url, url_to_path,
unpack_url)
from pip.exceptions import (InstallationError, BestVersionAlreadyInstalled,
from pipenv.patched.pip.exceptions import (InstallationError, BestVersionAlreadyInstalled,
DistributionNotFound, PreviousBuildDirError,
HashError, HashErrors, HashUnpinned,
DirectoryUrlHashUnsupported, VcsHashUnsupported,
UnsupportedPythonVersion)
from pip.req.req_install import InstallRequirement
from pip.utils import (
from pipenv.patched.pip.req.req_install import InstallRequirement
from pipenv.patched.pip.utils import (
display_path, dist_in_usersite, ensure_dir, normalize_path)
from pip.utils.hashes import MissingHashes
from pip.utils.logging import indent_log
from pip.utils.packaging import check_dist_requires_python
from pip.vcs import vcs
from pip.wheel import Wheel
from pipenv.patched.pip.utils.hashes import MissingHashes
from pipenv.patched.pip.utils.logging import indent_log
from pipenv.patched.pip.utils.packaging import check_dist_requires_python
from pipenv.patched.pip.vcs import vcs
from pipenv.patched.pip.wheel import Wheel
logger = logging.getLogger(__name__)