From dadb372d61ae02dd5fd59bfc47382d57c55b46a8 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 10 Mar 2018 11:17:31 -0500 Subject: [PATCH] make most of pip relative imports Signed-off-by: Kenneth Reitz --- pipenv/patched/pip/__init__.py | 19 +++++++++--------- pipenv/patched/pip/basecommand.py | 24 +++++++++++------------ pipenv/patched/pip/commands/__init__.py | 24 +++++++++++------------ pipenv/patched/pip/commands/check.py | 6 +++--- pipenv/patched/pip/commands/completion.py | 2 +- pipenv/patched/pip/commands/download.py | 16 +++++++-------- pipenv/patched/pip/commands/freeze.py | 8 ++++---- pipenv/patched/pip/commands/hash.py | 8 ++++---- pipenv/patched/pip/commands/help.py | 4 ++-- pipenv/patched/pip/commands/install.py | 20 +++++++++---------- pipenv/patched/pip/commands/list.py | 14 ++++++------- pipenv/patched/pip/commands/search.py | 22 ++++++++++----------- pipenv/patched/pip/commands/show.py | 8 ++++---- pipenv/patched/pip/commands/uninstall.py | 8 ++++---- pipenv/patched/pip/commands/wheel.py | 16 +++++++-------- pipenv/patched/pip/req/req_set.py | 24 +++++++++++------------ 16 files changed, 111 insertions(+), 112 deletions(-) diff --git a/pipenv/patched/pip/__init__.py b/pipenv/patched/pip/__init__.py index 9c1d8f96..45748b97 100755 --- a/pipenv/patched/pip/__init__.py +++ b/pipenv/patched/pip/__init__.py @@ -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" diff --git a/pipenv/patched/pip/basecommand.py b/pipenv/patched/pip/basecommand.py index 54c67067..87c6c6e1 100644 --- a/pipenv/patched/pip/basecommand.py +++ b/pipenv/patched/pip/basecommand.py @@ -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'] diff --git a/pipenv/patched/pip/commands/__init__.py b/pipenv/patched/pip/commands/__init__.py index 62c64ebe..657ad9aa 100644 --- a/pipenv/patched/pip/commands/__init__.py +++ b/pipenv/patched/pip/commands/__init__.py @@ -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 = { diff --git a/pipenv/patched/pip/commands/check.py b/pipenv/patched/pip/commands/check.py index 70458adf..8ef2bd33 100644 --- a/pipenv/patched/pip/commands/check.py +++ b/pipenv/patched/pip/commands/check.py @@ -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__) diff --git a/pipenv/patched/pip/commands/completion.py b/pipenv/patched/pip/commands/completion.py index 66e41a67..4eac0c38 100644 --- a/pipenv/patched/pip/commands/completion.py +++ b/pipenv/patched/pip/commands/completion.py @@ -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 diff --git a/pipenv/patched/pip/commands/download.py b/pipenv/patched/pip/commands/download.py index 4bc06408..92efcd53 100644 --- a/pipenv/patched/pip/commands/download.py +++ b/pipenv/patched/pip/commands/download.py @@ -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__) diff --git a/pipenv/patched/pip/commands/freeze.py b/pipenv/patched/pip/commands/freeze.py index c1987961..dc44546d 100644 --- a/pipenv/patched/pip/commands/freeze.py +++ b/pipenv/patched/pip/commands/freeze.py @@ -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') diff --git a/pipenv/patched/pip/commands/hash.py b/pipenv/patched/pip/commands/hash.py index 27cca0bf..bc8afb6b 100644 --- a/pipenv/patched/pip/commands/hash.py +++ b/pipenv/patched/pip/commands/hash.py @@ -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__) diff --git a/pipenv/patched/pip/commands/help.py b/pipenv/patched/pip/commands/help.py index 11722f1e..3d0225f4 100644 --- a/pipenv/patched/pip/commands/help.py +++ b/pipenv/patched/pip/commands/help.py @@ -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): diff --git a/pipenv/patched/pip/commands/install.py b/pipenv/patched/pip/commands/install.py index 227c5264..610da050 100644 --- a/pipenv/patched/pip/commands/install.py +++ b/pipenv/patched/pip/commands/install.py @@ -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__) diff --git a/pipenv/patched/pip/commands/list.py b/pipenv/patched/pip/commands/list.py index 6f6995d7..de7bbf2a 100644 --- a/pipenv/patched/pip/commands/list.py +++ b/pipenv/patched/pip/commands/list.py @@ -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__) diff --git a/pipenv/patched/pip/commands/search.py b/pipenv/patched/pip/commands/search.py index bd2ea8ad..2f8aaacf 100644 --- a/pipenv/patched/pip/commands/search.py +++ b/pipenv/patched/pip/commands/search.py @@ -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__) diff --git a/pipenv/patched/pip/commands/show.py b/pipenv/patched/pip/commands/show.py index 111c16d1..396da6cf 100644 --- a/pipenv/patched/pip/commands/show.py +++ b/pipenv/patched/pip/commands/show.py @@ -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__) diff --git a/pipenv/patched/pip/commands/uninstall.py b/pipenv/patched/pip/commands/uninstall.py index 8ba1a7c6..1e929018 100644 --- a/pipenv/patched/pip/commands/uninstall.py +++ b/pipenv/patched/pip/commands/uninstall.py @@ -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): diff --git a/pipenv/patched/pip/commands/wheel.py b/pipenv/patched/pip/commands/wheel.py index 70e95eb8..059d0563 100644 --- a/pipenv/patched/pip/commands/wheel.py +++ b/pipenv/patched/pip/commands/wheel.py @@ -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__) diff --git a/pipenv/patched/pip/req/req_set.py b/pipenv/patched/pip/req/req_set.py index c3a88f63..15917fb8 100644 --- a/pipenv/patched/pip/req/req_set.py +++ b/pipenv/patched/pip/req/req_set.py @@ -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__)