diff --git a/src/pip/_internal/baseparser.py b/src/pip/_internal/baseparser.py index f2f205f8a05..269190b590e 100644 --- a/src/pip/_internal/baseparser.py +++ b/src/pip/_internal/baseparser.py @@ -9,8 +9,8 @@ from pip._vendor.six import string_types -from pip._internal.compat import get_terminal_size from pip._internal.configuration import Configuration, ConfigurationError +from pip._internal.utils.compat import get_terminal_size logger = logging.getLogger(__name__) diff --git a/src/pip/_internal/cache.py b/src/pip/_internal/cache.py index 91d54b1b023..1768b285587 100644 --- a/src/pip/_internal/cache.py +++ b/src/pip/_internal/cache.py @@ -9,9 +9,9 @@ from pip._vendor.packaging.utils import canonicalize_name from pip._internal import index -from pip._internal.compat import expanduser from pip._internal.download import path_to_url from pip._internal.models.link import Link +from pip._internal.utils.compat import expanduser from pip._internal.utils.temp_dir import TempDirectory from pip._internal.wheel import InvalidWheelFilename, Wheel diff --git a/src/pip/_internal/commands/freeze.py b/src/pip/_internal/commands/freeze.py index 0d3d4ae2404..f06a4c87881 100644 --- a/src/pip/_internal/commands/freeze.py +++ b/src/pip/_internal/commands/freeze.py @@ -5,8 +5,8 @@ from pip._internal import index from pip._internal.basecommand import Command from pip._internal.cache import WheelCache -from pip._internal.compat import stdlib_pkgs from pip._internal.operations.freeze import freeze +from pip._internal.utils.compat import stdlib_pkgs DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'} diff --git a/src/pip/_internal/commands/search.py b/src/pip/_internal/commands/search.py index a47a9a7de26..75c95c1e39c 100644 --- a/src/pip/_internal/commands/search.py +++ b/src/pip/_internal/commands/search.py @@ -12,11 +12,11 @@ from pip._vendor.six.moves import xmlrpc_client # type: ignore from pip._internal.basecommand import SUCCESS, Command -from pip._internal.compat import get_terminal_size from pip._internal.download import PipXmlrpcTransport from pip._internal.exceptions import CommandError from pip._internal.models.index import PyPI from pip._internal.status_codes import NO_MATCHES_FOUND +from pip._internal.utils.compat import get_terminal_size from pip._internal.utils.logging import indent_log logger = logging.getLogger(__name__) diff --git a/src/pip/_internal/index.py b/src/pip/_internal/index.py index 5f4899e018f..da6d5d868ac 100644 --- a/src/pip/_internal/index.py +++ b/src/pip/_internal/index.py @@ -20,7 +20,6 @@ from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request -from pip._internal.compat import ipaddress from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path from pip._internal.exceptions import ( BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename, @@ -30,6 +29,7 @@ from pip._internal.models.index import PyPI from pip._internal.models.link import Link from pip._internal.pep425tags import get_supported +from pip._internal.utils.compat import ipaddress from pip._internal.utils.deprecation import deprecated from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( diff --git a/src/pip/_internal/locations.py b/src/pip/_internal/locations.py index 4a7b61e0c33..183aaa39299 100644 --- a/src/pip/_internal/locations.py +++ b/src/pip/_internal/locations.py @@ -10,8 +10,8 @@ from distutils import sysconfig as distutils_sysconfig from distutils.command.install import SCHEME_KEYS # type: ignore -from pip._internal.compat import WINDOWS, expanduser from pip._internal.utils import appdirs +from pip._internal.utils.compat import WINDOWS, expanduser # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") diff --git a/src/pip/_internal/operations/prepare.py b/src/pip/_internal/operations/prepare.py index 7740c284340..165e76e0538 100644 --- a/src/pip/_internal/operations/prepare.py +++ b/src/pip/_internal/operations/prepare.py @@ -7,7 +7,6 @@ from pip._vendor import pkg_resources, requests from pip._internal.build_env import BuildEnvironment -from pip._internal.compat import expanduser from pip._internal.download import ( is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path, ) @@ -15,6 +14,7 @@ DirectoryUrlHashUnsupported, HashUnpinned, InstallationError, PreviousBuildDirError, VcsHashUnsupported, ) +from pip._internal.utils.compat import expanduser from pip._internal.utils.hashes import MissingHashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import display_path, normalize_path diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index e90daf1595c..7f9ff4e0fc5 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -23,7 +23,6 @@ from pip._internal import wheel from pip._internal.build_env import NoOpBuildEnvironment -from pip._internal.compat import native_str from pip._internal.download import ( is_archive_file, is_url, path_to_url, url_to_path, ) @@ -34,6 +33,7 @@ from pip._internal.models.index import PyPI, TestPyPI from pip._internal.models.link import Link from pip._internal.req.req_uninstall import UninstallPathSet +from pip._internal.utils.compat import native_str from pip._internal.utils.hashes import Hashes from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( diff --git a/src/pip/_internal/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py index 32ac6b2f7d2..a7d82301686 100644 --- a/src/pip/_internal/req/req_uninstall.py +++ b/src/pip/_internal/req/req_uninstall.py @@ -9,9 +9,9 @@ from pip._vendor import pkg_resources -from pip._internal.compat import WINDOWS, cache_from_source, uses_pycache from pip._internal.exceptions import UninstallationError from pip._internal.locations import bin_py, bin_user +from pip._internal.utils.compat import WINDOWS, cache_from_source, uses_pycache from pip._internal.utils.logging import indent_log from pip._internal.utils.misc import ( FakeFile, ask, dist_in_usersite, dist_is_local, egg_link_path, is_local, diff --git a/src/pip/_internal/utils/appdirs.py b/src/pip/_internal/utils/appdirs.py index 28c5d4b3c75..cc96f9841ee 100644 --- a/src/pip/_internal/utils/appdirs.py +++ b/src/pip/_internal/utils/appdirs.py @@ -9,7 +9,7 @@ from pip._vendor.six import PY2, text_type -from pip._internal.compat import WINDOWS, expanduser +from pip._internal.utils.compat import WINDOWS, expanduser def user_cache_dir(appname): diff --git a/src/pip/_internal/utils/filesystem.py b/src/pip/_internal/utils/filesystem.py index ee455012e16..1e9cebd079a 100644 --- a/src/pip/_internal/utils/filesystem.py +++ b/src/pip/_internal/utils/filesystem.py @@ -1,7 +1,7 @@ import os import os.path -from pip._internal.compat import get_path_uid +from pip._internal.utils.compat import get_path_uid def check_path_owner(path): diff --git a/src/pip/_internal/utils/logging.py b/src/pip/_internal/utils/logging.py index 66c1d39d7e1..d9b95414482 100644 --- a/src/pip/_internal/utils/logging.py +++ b/src/pip/_internal/utils/logging.py @@ -5,7 +5,7 @@ import logging.handlers import os -from pip._internal.compat import WINDOWS +from pip._internal.utils.compat import WINDOWS from pip._internal.utils.misc import ensure_dir try: diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py index c172163755b..c6c8a09d09a 100644 --- a/src/pip/_internal/utils/misc.py +++ b/src/pip/_internal/utils/misc.py @@ -26,14 +26,14 @@ from pip._vendor.six.moves import input from pip._vendor.six.moves.urllib import parse as urllib_parse -from pip._internal.compat import ( - WINDOWS, console_to_str, expanduser, stdlib_pkgs, -) from pip._internal.exceptions import CommandError, InstallationError from pip._internal.locations import ( running_under_virtualenv, site_packages, user_site, virtualenv_no_global, write_delete_marker_file, ) +from pip._internal.utils.compat import ( + WINDOWS, console_to_str, expanduser, stdlib_pkgs, +) if PY2: from io import BytesIO as StringIO diff --git a/src/pip/_internal/utils/outdated.py b/src/pip/_internal/utils/outdated.py index 2b3fa95e336..4c084ab996a 100644 --- a/src/pip/_internal/utils/outdated.py +++ b/src/pip/_internal/utils/outdated.py @@ -9,8 +9,8 @@ from pip._vendor import lockfile, pkg_resources from pip._vendor.packaging import version as packaging_version -from pip._internal.compat import WINDOWS from pip._internal.index import PackageFinder +from pip._internal.utils.compat import WINDOWS from pip._internal.utils.filesystem import check_path_owner from pip._internal.utils.misc import ensure_dir, get_installed_version diff --git a/src/pip/_internal/utils/ui.py b/src/pip/_internal/utils/ui.py index 9429aaee496..6bab904ab44 100644 --- a/src/pip/_internal/utils/ui.py +++ b/src/pip/_internal/utils/ui.py @@ -15,7 +15,7 @@ from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin from pip._vendor.progress.spinner import Spinner -from pip._internal.compat import WINDOWS +from pip._internal.utils.compat import WINDOWS from pip._internal.utils.logging import get_indentation from pip._internal.utils.misc import format_size from pip._internal.utils.typing import MYPY_CHECK_RUNNING diff --git a/src/pip/_internal/vcs/git.py b/src/pip/_internal/vcs/git.py index 5376caa3214..a3e4a48c2ad 100644 --- a/src/pip/_internal/vcs/git.py +++ b/src/pip/_internal/vcs/git.py @@ -8,8 +8,8 @@ from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request -from pip._internal.compat import samefile from pip._internal.exceptions import BadCommand +from pip._internal.utils.compat import samefile from pip._internal.utils.misc import display_path from pip._internal.utils.temp_dir import TempDirectory from pip._internal.vcs import VersionControl, vcs diff --git a/tests/functional/test_install_user.py b/tests/functional/test_install_user.py index 35bfedafa88..09edcb96523 100644 --- a/tests/functional/test_install_user.py +++ b/tests/functional/test_install_user.py @@ -7,7 +7,7 @@ import pytest -from pip._internal.compat import cache_from_source, uses_pycache +from pip._internal.utils.compat import cache_from_source, uses_pycache from tests.lib import pyversion from tests.lib.local_repos import local_checkout diff --git a/tests/unit/test_cache.py b/tests/unit/test_cache.py index 0f080b6570b..d75cd2c654f 100644 --- a/tests/unit/test_cache.py +++ b/tests/unit/test_cache.py @@ -1,5 +1,5 @@ from pip._internal.cache import WheelCache -from pip._internal.compat import expanduser +from pip._internal.utils.compat import expanduser class TestWheelCache: diff --git a/tests/unit/test_compat.py b/tests/unit/test_compat.py index aed5e5919cb..70ee2c36d27 100644 --- a/tests/unit/test_compat.py +++ b/tests/unit/test_compat.py @@ -3,8 +3,8 @@ import pytest -import pip._internal.compat -from pip._internal.compat import ( +import pip._internal.utils.compat as pip_compat +from pip._internal.utils.compat import ( console_to_str, expanduser, get_path_uid, native_str, ) @@ -64,7 +64,7 @@ def check_warning(msg, *args, **kwargs): "Subprocess output does not appear to be encoded as") monkeypatch.setattr(locale, 'getpreferredencoding', lambda: 'utf-8') - monkeypatch.setattr(pip._internal.compat.logger, 'warning', check_warning) + monkeypatch.setattr(pip_compat.logger, 'warning', check_warning) console_to_str(some_bytes) diff --git a/tests/unit/test_wheel.py b/tests/unit/test_wheel.py index 0fb9075896b..a9be9bfe879 100644 --- a/tests/unit/test_wheel.py +++ b/tests/unit/test_wheel.py @@ -7,8 +7,8 @@ from pip._vendor.packaging.requirements import Requirement from pip._internal import pep425tags, wheel -from pip._internal.compat import WINDOWS from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel +from pip._internal.utils.compat import WINDOWS from pip._internal.utils.misc import unpack_file from tests.lib import DATA_DIR