1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Move all internal APIs to pip._internal

This commit is contained in:
Donald Stufft 2017-08-31 11:48:18 -04:00
parent c58a4ccf1d
commit 95bcf8c5f6
342 changed files with 595 additions and 550 deletions

View file

@ -1,2 +1,2 @@
ignore-paths: ignore-paths:
- pip/_vendor/ - src/pip/_vendor/

View file

@ -11,13 +11,13 @@ tox --notest
if [[ $VENDOR = "no" ]]; then if [[ $VENDOR = "no" ]]; then
# Install our dependencies if we're not installing from wheels # Install our dependencies if we're not installing from wheels
if [[ $WHEELS != "yes" ]]; then if [[ $WHEELS != "yes" ]]; then
.tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt --no-deps .tox/$TOXENV/bin/pip install -r src/pip/_vendor/vendor.txt --no-deps
fi fi
# Install our dependencies if we're installing from wheels # Install our dependencies if we're installing from wheels
if [[ $WHEELS = "yes" ]]; then if [[ $WHEELS = "yes" ]]; then
mkdir -p /tmp/wheels mkdir -p /tmp/wheels
pip wheel --wheel-dir /tmp/wheels --no-deps -r pip/_vendor/vendor.txt pip wheel --wheel-dir /tmp/wheels --no-deps -r src/pip/_vendor/vendor.txt
cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/` cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/`
fi fi

View file

@ -3,19 +3,19 @@ include LICENSE.txt
include NEWS.rst include NEWS.rst
include README.rst include README.rst
include pyproject.toml include pyproject.toml
include pip/_vendor/README.rst include src/pip/_vendor/README.rst
include pip/_vendor/vendor.txt include src/pip/_vendor/vendor.txt
exclude .coveragerc exclude .coveragerc
exclude .mailmap exclude .mailmap
exclude .travis.yml exclude .travis.yml
exclude .landscape.yml exclude .landscape.yml
exclude pip/_vendor/Makefile exclude src/pip/_vendor/Makefile
exclude tox.ini exclude tox.ini
exclude dev-requirements.txt exclude dev-requirements.txt
exclude appveyor.yml exclude appveyor.yml
recursive-include pip/_vendor *.pem recursive-include src/pip/_vendor *.pem
recursive-include docs Makefile *.rst *.py *.bat recursive-include docs Makefile *.rst *.py *.bat
prune .github prune .github

View file

@ -6,9 +6,9 @@ from docutils import nodes
from docutils.parsers import rst from docutils.parsers import rst
from docutils.statemachine import ViewList from docutils.statemachine import ViewList
from textwrap import dedent from textwrap import dedent
from pip.commands import commands_dict as commands from pip._internal import cmdoptions
from pip import cmdoptions from pip._internal.commands import commands_dict as commands
from pip.utils import get_prog from pip._internal.utils.misc import get_prog
class PipCommandUsage(rst.Directive): class PipCommandUsage(rst.Directive):

2
news/4696.removal Normal file
View file

@ -0,0 +1,2 @@
Move all of pip's APIs into the pip._internal package, properly reflecting the
fact that pip does not currently have any public APIs.

2
news/4700.removal Normal file
View file

@ -0,0 +1,2 @@
Move all of pip's APIs into the pip._internal package, properly reflecting the
fact that pip does not currently have any public APIs.

View file

@ -1,4 +0,0 @@
from pip.models.index import Index, PyPI
__all__ = ["Index", "PyPI"]

View file

@ -15,7 +15,7 @@ exclude = .tox,.idea,*.egg,build,_vendor,data
select = E,W,F select = E,W,F
[tool:pytest] [tool:pytest]
addopts = --ignore pip/_vendor --ignore tests/tests_cache addopts = --ignore src/pip/_vendor --ignore tests/tests_cache
[bdist_wheel] [bdist_wheel]
universal=1 universal=1

View file

@ -38,7 +38,7 @@ tests_require = [
setup( setup(
name="pip", name="pip",
version=find_version("pip", "__init__.py"), version=find_version("src", "pip", "__init__.py"),
description="The PyPA recommended tool for installing Python packages.", description="The PyPA recommended tool for installing Python packages.",
long_description=long_description, long_description=long_description,
classifiers=[ classifiers=[
@ -60,7 +60,11 @@ setup(
author_email='python-virtualenv@groups.google.com', author_email='python-virtualenv@groups.google.com',
url='https://pip.pypa.io/', url='https://pip.pypa.io/',
license='MIT', license='MIT',
packages=find_packages(exclude=["contrib", "docs", "tests*", "tasks"]), package_dir={"": "src"},
packages=find_packages(
where="src",
exclude=["contrib", "docs", "tests*", "tasks"],
),
package_data={ package_data={
"pip._vendor.certifi": ["*.pem"], "pip._vendor.certifi": ["*.pem"],
"pip._vendor.requests": ["*.pem"], "pip._vendor.requests": ["*.pem"],
@ -69,9 +73,9 @@ setup(
}, },
entry_points={ entry_points={
"console_scripts": [ "console_scripts": [
"pip=pip:main", "pip=pip._internal:main",
"pip%s=pip:main" % sys.version[:1], "pip%s=pip._internal:main" % sys.version[:1],
"pip%s=pip:main" % sys.version[:3], "pip%s=pip._internal:main" % sys.version[:3],
], ],
}, },
tests_require=tests_require, tests_require=tests_require,

1
src/pip/__init__.py Normal file
View file

@ -0,0 +1 @@
__version__ = "10.0.0.dev0"

View file

@ -13,7 +13,7 @@ if __package__ == '':
path = os.path.dirname(os.path.dirname(__file__)) path = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, path) sys.path.insert(0, path)
import pip # noqa from pip._internal import main as _main # noqa
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(pip.main()) sys.exit(_main())

View file

@ -40,13 +40,17 @@ else:
else: else:
securetransport.inject_into_urllib3() securetransport.inject_into_urllib3()
from pip.exceptions import CommandError, PipError from pip import __version__
from pip.utils import get_installed_distributions, get_prog from pip._internal import cmdoptions
from pip.utils import deprecation from pip._internal.exceptions import CommandError, PipError
from pip.vcs import git, mercurial, subversion, bazaar # noqa from pip._internal.utils.misc import get_installed_distributions, get_prog
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.utils import deprecation
from pip.commands import get_summaries, get_similar_commands from pip._internal.vcs import git, mercurial, subversion, bazaar # noqa
from pip.commands import commands_dict from pip._internal.baseparser import (
ConfigOptionParser, UpdatingDefaultsHelpFormatter,
)
from pip._internal.commands import get_summaries, get_similar_commands
from pip._internal.commands import commands_dict
from pip._vendor.requests.packages.urllib3.exceptions import ( from pip._vendor.requests.packages.urllib3.exceptions import (
InsecureRequestWarning, InsecureRequestWarning,
) )
@ -57,12 +61,8 @@ from pip._vendor.requests.packages.urllib3.exceptions import (
# This fixes a peculiarity when importing via __import__ - as we are # This fixes a peculiarity when importing via __import__ - as we are
# initialising the pip module, "from pip import cmdoptions" is recursive # initialising the pip module, "from pip import cmdoptions" is recursive
# and appears not to work properly in that situation. # and appears not to work properly in that situation.
import pip.cmdoptions # import pip._internal.cmdoptions
cmdoptions = pip.cmdoptions # cmdoptions = pip._internal.cmdoptions
# The version as used in the setup.py and the docs conf.py
__version__ = "10.0.0.dev0"
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -249,7 +249,3 @@ def main(args=None):
logger.debug("Ignoring error %s when setting locale", e) logger.debug("Ignoring error %s when setting locale", e)
command = commands_dict[cmd_name](isolated=check_isolated(cmd_args)) command = commands_dict[cmd_name](isolated=check_isolated(cmd_args))
return command.main(cmd_args) return command.main(cmd_args)
if __name__ == '__main__':
sys.exit(main())

View file

@ -8,24 +8,27 @@ import os
import sys import sys
import warnings import warnings
from pip import cmdoptions from pip._internal import cmdoptions
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter from pip._internal.baseparser import (
from pip.compat import WINDOWS ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.download import PipSession )
from pip.exceptions import ( from pip._internal.compat import WINDOWS
from pip._internal.download import PipSession
from pip._internal.exceptions import (
BadCommand, CommandError, InstallationError, PreviousBuildDirError, BadCommand, CommandError, InstallationError, PreviousBuildDirError,
UninstallationError UninstallationError
) )
from pip.index import PackageFinder from pip._internal.index import PackageFinder
from pip.locations import running_under_virtualenv from pip._internal.locations import running_under_virtualenv
from pip.req import InstallRequirement, parse_requirements from pip._internal.req import InstallRequirement, parse_requirements
from pip.status_codes import ( from pip._internal.status_codes import (
ERROR, PREVIOUS_BUILD_DIR_ERROR, SUCCESS, UNKNOWN_ERROR, ERROR, PREVIOUS_BUILD_DIR_ERROR, SUCCESS, UNKNOWN_ERROR,
VIRTUALENV_NOT_FOUND VIRTUALENV_NOT_FOUND
) )
from pip.utils import deprecation, get_prog, normalize_path from pip._internal.utils import deprecation
from pip.utils.logging import IndentingFormatter from pip._internal.utils.logging import IndentingFormatter
from pip.utils.outdated import pip_version_check from pip._internal.utils.misc import get_prog, normalize_path
from pip._internal.utils.outdated import pip_version_check
__all__ = ['Command'] __all__ = ['Command']
@ -130,7 +133,7 @@ class Command(object):
"disable_existing_loggers": False, "disable_existing_loggers": False,
"filters": { "filters": {
"exclude_warnings": { "exclude_warnings": {
"()": "pip.utils.logging.MaxLevelFilter", "()": "pip._internal.utils.logging.MaxLevelFilter",
"level": logging.WARNING, "level": logging.WARNING,
}, },
}, },
@ -143,20 +146,24 @@ class Command(object):
"handlers": { "handlers": {
"console": { "console": {
"level": level, "level": level,
"class": "pip.utils.logging.ColorizedStreamHandler", "class":
"pip._internal.utils.logging.ColorizedStreamHandler",
"stream": self.log_streams[0], "stream": self.log_streams[0],
"filters": ["exclude_warnings"], "filters": ["exclude_warnings"],
"formatter": "indent", "formatter": "indent",
}, },
"console_errors": { "console_errors": {
"level": "WARNING", "level": "WARNING",
"class": "pip.utils.logging.ColorizedStreamHandler", "class":
"pip._internal.utils.logging.ColorizedStreamHandler",
"stream": self.log_streams[1], "stream": self.log_streams[1],
"formatter": "indent", "formatter": "indent",
}, },
"user_log": { "user_log": {
"level": "DEBUG", "level": "DEBUG",
"class": "pip.utils.logging.BetterRotatingFileHandler", "class":
("pip._internal.utils.logging"
".BetterRotatingFileHandler"),
"filename": options.log or "/dev/null", "filename": options.log or "/dev/null",
"delay": True, "delay": True,
"formatter": "indent", "formatter": "indent",

View file

@ -9,8 +9,8 @@ from distutils.util import strtobool
from pip._vendor.six import string_types from pip._vendor.six import string_types
from pip.configuration import Configuration from pip._internal.configuration import Configuration
from pip.utils import get_terminal_size from pip._internal.utils.misc import get_terminal_size
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -8,10 +8,10 @@ import os
from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.utils import canonicalize_name
import pip.index from pip._internal import index
from pip.compat import expanduser from pip._internal.compat import expanduser
from pip.download import path_to_url from pip._internal.download import path_to_url
from pip.wheel import InvalidWheelFilename, Wheel from pip._internal.wheel import InvalidWheelFilename, Wheel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -71,7 +71,7 @@ class Cache(object):
return [] return []
canonical_name = canonicalize_name(package_name) canonical_name = canonicalize_name(package_name)
formats = pip.index.fmt_ctl_formats( formats = index.fmt_ctl_formats(
self.format_control, canonical_name self.format_control, canonical_name
) )
if not self.allowed_formats.intersection(formats): if not self.allowed_formats.intersection(formats):
@ -100,7 +100,7 @@ class Cache(object):
root = self.get_path_for_link(link) root = self.get_path_for_link(link)
path = os.path.join(root, candidate) path = os.path.join(root, candidate)
return pip.index.Link(path_to_url(path)) return index.Link(path_to_url(path))
class WheelCache(Cache): class WheelCache(Cache):

View file

@ -13,13 +13,13 @@ import warnings
from functools import partial from functools import partial
from optparse import SUPPRESS_HELP, Option, OptionGroup from optparse import SUPPRESS_HELP, Option, OptionGroup
from pip.index import ( from pip._internal.index import (
FormatControl, fmt_ctl_handle_mutual_exclude, fmt_ctl_no_binary FormatControl, fmt_ctl_handle_mutual_exclude, fmt_ctl_no_binary
) )
from pip.locations import USER_CACHE_DIR, src_prefix from pip._internal.locations import USER_CACHE_DIR, src_prefix
from pip.models import PyPI from pip._internal.models import PyPI
from pip.utils.hashes import STRONG_HASHES from pip._internal.utils.hashes import STRONG_HASHES
from pip.utils.ui import BAR_TYPES from pip._internal.utils.ui import BAR_TYPES
def make_option_group(group, parser): def make_option_group(group, parser):

View file

@ -3,19 +3,19 @@ Package containing all pip commands
""" """
from __future__ import absolute_import from __future__ import absolute_import
from pip.commands.completion import CompletionCommand from pip._internal.commands.completion import CompletionCommand
from pip.commands.configuration import ConfigurationCommand from pip._internal.commands.configuration import ConfigurationCommand
from pip.commands.download import DownloadCommand from pip._internal.commands.download import DownloadCommand
from pip.commands.freeze import FreezeCommand from pip._internal.commands.freeze import FreezeCommand
from pip.commands.hash import HashCommand from pip._internal.commands.hash import HashCommand
from pip.commands.help import HelpCommand from pip._internal.commands.help import HelpCommand
from pip.commands.list import ListCommand from pip._internal.commands.list import ListCommand
from pip.commands.check import CheckCommand from pip._internal.commands.check import CheckCommand
from pip.commands.search import SearchCommand from pip._internal.commands.search import SearchCommand
from pip.commands.show import ShowCommand from pip._internal.commands.show import ShowCommand
from pip.commands.install import InstallCommand from pip._internal.commands.install import InstallCommand
from pip.commands.uninstall import UninstallCommand from pip._internal.commands.uninstall import UninstallCommand
from pip.commands.wheel import WheelCommand from pip._internal.commands.wheel import WheelCommand
commands_order = [ commands_order = [
InstallCommand, InstallCommand,

View file

@ -1,8 +1,8 @@
import logging import logging
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.operations.check import check_requirements from pip._internal.operations.check import check_requirements
from pip.utils import get_installed_distributions from pip._internal.utils.misc import get_installed_distributions
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -3,7 +3,7 @@ from __future__ import absolute_import
import sys import sys
import textwrap import textwrap
from pip.basecommand import Command from pip._internal.basecommand import Command
BASE_COMPLETION = """ BASE_COMPLETION = """
# pip %(shell)s completion start%(script)s# pip %(shell)s completion end # pip %(shell)s completion start%(script)s# pip %(shell)s completion end

View file

@ -2,12 +2,12 @@ import logging
import os import os
import subprocess import subprocess
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.configuration import Configuration, kinds from pip._internal.configuration import Configuration, kinds
from pip.exceptions import PipError from pip._internal.exceptions import PipError
from pip.locations import venv_config_file from pip._internal.locations import venv_config_file
from pip.status_codes import ERROR, SUCCESS from pip._internal.status_codes import ERROR, SUCCESS
from pip.utils import get_prog from pip._internal.utils.misc import get_prog
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -3,16 +3,16 @@ from __future__ import absolute_import
import logging import logging
import os import os
from pip import cmdoptions from pip._internal import cmdoptions
from pip.basecommand import RequirementCommand from pip._internal.basecommand import RequirementCommand
from pip.exceptions import CommandError from pip._internal.exceptions import CommandError
from pip.index import FormatControl from pip._internal.index import FormatControl
from pip.operations.prepare import RequirementPreparer from pip._internal.operations.prepare import RequirementPreparer
from pip.req import RequirementSet from pip._internal.req import RequirementSet
from pip.resolve import Resolver from pip._internal.resolve import Resolver
from pip.utils import ensure_dir, normalize_path from pip._internal.utils.filesystem import check_path_owner
from pip.utils.filesystem import check_path_owner from pip._internal.utils.misc import ensure_dir, normalize_path
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -2,11 +2,11 @@ from __future__ import absolute_import
import sys import sys
import pip from pip._internal import index
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.cache import WheelCache from pip._internal.cache import WheelCache
from pip.compat import stdlib_pkgs from pip._internal.compat import stdlib_pkgs
from pip.operations.freeze import freeze from pip._internal.operations.freeze import freeze
DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'} DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}
@ -71,7 +71,7 @@ class FreezeCommand(Command):
self.parser.insert_option_group(0, self.cmd_opts) self.parser.insert_option_group(0, self.cmd_opts)
def run(self, options, args): def run(self, options, args):
format_control = pip.index.FormatControl(set(), set()) format_control = index.FormatControl(set(), set())
wheel_cache = WheelCache(options.cache_dir, format_control) wheel_cache = WheelCache(options.cache_dir, format_control)
skip = set(stdlib_pkgs) skip = set(stdlib_pkgs)
if not options.freeze_all: if not options.freeze_all:

View file

@ -4,10 +4,10 @@ import hashlib
import logging import logging
import sys import sys
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.status_codes import ERROR from pip._internal.status_codes import ERROR
from pip.utils import read_chunks from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES from pip._internal.utils.misc import read_chunks
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -1,7 +1,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from pip.basecommand import SUCCESS, Command from pip._internal.basecommand import SUCCESS, Command
from pip.exceptions import CommandError from pip._internal.exceptions import CommandError
class HelpCommand(Command): class HelpCommand(Command):
@ -13,7 +13,7 @@ class HelpCommand(Command):
ignore_require_venv = True ignore_require_venv = True
def run(self, options, args): def run(self, options, args):
from pip.commands import commands_dict, get_similar_commands from pip._internal.commands import commands_dict, get_similar_commands
try: try:
# 'pip help' with no args is handled by pip.__init__.parseopt() # 'pip help' with no args is handled by pip.__init__.parseopt()

View file

@ -6,21 +6,21 @@ import operator
import os import os
import shutil import shutil
from pip import cmdoptions from pip._internal import cmdoptions
from pip.basecommand import RequirementCommand from pip._internal.basecommand import RequirementCommand
from pip.cache import WheelCache from pip._internal.cache import WheelCache
from pip.exceptions import ( from pip._internal.exceptions import (
CommandError, InstallationError, PreviousBuildDirError CommandError, InstallationError, PreviousBuildDirError
) )
from pip.locations import distutils_scheme, virtualenv_no_global from pip._internal.locations import distutils_scheme, virtualenv_no_global
from pip.operations.prepare import RequirementPreparer from pip._internal.operations.prepare import RequirementPreparer
from pip.req import RequirementSet from pip._internal.req import RequirementSet
from pip.resolve import Resolver from pip._internal.resolve import Resolver
from pip.status_codes import ERROR from pip._internal.status_codes import ERROR
from pip.utils import ensure_dir, get_installed_version from pip._internal.utils.filesystem import check_path_owner
from pip.utils.filesystem import check_path_owner from pip._internal.utils.misc import ensure_dir, get_installed_version
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
from pip.wheel import WheelBuilder from pip._internal.wheel import WheelBuilder
try: try:
import wheel import wheel

View file

@ -6,13 +6,15 @@ import warnings
from pip._vendor import six from pip._vendor import six
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.cmdoptions import index_group, make_option_group from pip._internal.cmdoptions import index_group, make_option_group
from pip.exceptions import CommandError from pip._internal.exceptions import CommandError
from pip.index import PackageFinder from pip._internal.index import PackageFinder
from pip.utils import dist_is_editable, get_installed_distributions from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip.utils.deprecation import RemovedInPip11Warning from pip._internal.utils.misc import (
from pip.utils.packaging import get_installer dist_is_editable, get_installed_distributions
)
from pip._internal.utils.packaging import get_installer
try: try:
from itertools import zip_longest from itertools import zip_longest

View file

@ -9,13 +9,13 @@ from pip._vendor import pkg_resources
from pip._vendor.packaging.version import parse as parse_version from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves import xmlrpc_client from pip._vendor.six.moves import xmlrpc_client
from pip.basecommand import SUCCESS, Command from pip._internal.basecommand import SUCCESS, Command
from pip.download import PipXmlrpcTransport from pip._internal.download import PipXmlrpcTransport
from pip.exceptions import CommandError from pip._internal.exceptions import CommandError
from pip.models import PyPI from pip._internal.models import PyPI
from pip.status_codes import NO_MATCHES_FOUND from pip._internal.status_codes import NO_MATCHES_FOUND
from pip.utils import get_terminal_size from pip._internal.utils.logging import indent_log
from pip.utils.logging import indent_log from pip._internal.utils.misc import get_terminal_size
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -7,8 +7,8 @@ from email.parser import FeedParser
from pip._vendor import pkg_resources from pip._vendor import pkg_resources
from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.utils import canonicalize_name
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.status_codes import ERROR, SUCCESS from pip._internal.status_codes import ERROR, SUCCESS
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -2,9 +2,9 @@ from __future__ import absolute_import
from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.utils import canonicalize_name
from pip.basecommand import Command from pip._internal.basecommand import Command
from pip.exceptions import InstallationError from pip._internal.exceptions import InstallationError
from pip.req import InstallRequirement, parse_requirements from pip._internal.req import InstallRequirement, parse_requirements
class UninstallCommand(Command): class UninstallCommand(Command):

View file

@ -4,16 +4,16 @@ from __future__ import absolute_import
import logging import logging
import os import os
from pip import cmdoptions from pip._internal import cmdoptions
from pip.basecommand import RequirementCommand from pip._internal.basecommand import RequirementCommand
from pip.cache import WheelCache from pip._internal.cache import WheelCache
from pip.exceptions import CommandError, PreviousBuildDirError from pip._internal.exceptions import CommandError, PreviousBuildDirError
from pip.operations.prepare import RequirementPreparer from pip._internal.operations.prepare import RequirementPreparer
from pip.req import RequirementSet from pip._internal.req import RequirementSet
from pip.resolve import Resolver from pip._internal.resolve import Resolver
from pip.utils import import_or_raise from pip._internal.utils.misc import import_or_raise
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
from pip.wheel import WheelBuilder from pip._internal.wheel import WheelBuilder
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -17,12 +17,12 @@ import os
from pip._vendor.six import next from pip._vendor.six import next
from pip._vendor.six.moves import configparser from pip._vendor.six.moves import configparser
from pip.exceptions import ConfigurationError from pip._internal.exceptions import ConfigurationError
from pip.locations import ( from pip._internal.locations import (
legacy_config_file, new_config_file, running_under_virtualenv, legacy_config_file, new_config_file, running_under_virtualenv,
site_config_files, venv_config_file site_config_files, venv_config_file
) )
from pip.utils import ensure_dir, enum from pip._internal.utils.misc import ensure_dir, enum
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -28,22 +28,22 @@ from pip._vendor.six.moves.urllib import request as urllib_request
from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
import pip import pip
from pip.exceptions import HashMismatch, InstallationError from pip._internal.exceptions import HashMismatch, InstallationError
from pip.locations import write_delete_marker_file from pip._internal.locations import write_delete_marker_file
from pip.models import PyPI from pip._internal.models import PyPI
from pip.utils import ( from pip._internal.utils.encoding import auto_decode
from pip._internal.utils.filesystem import check_path_owner
from pip._internal.utils.glibc import libc_ver
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
ARCHIVE_EXTENSIONS, ask_path_exists, backup_dir, call_subprocess, consume, ARCHIVE_EXTENSIONS, ask_path_exists, backup_dir, call_subprocess, consume,
display_path, format_size, get_installed_version, rmtree, splitext, display_path, format_size, get_installed_version, rmtree, splitext,
unpack_file unpack_file
) )
from pip.utils.encoding import auto_decode from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
from pip.utils.filesystem import check_path_owner from pip._internal.utils.temp_dir import TempDirectory
from pip.utils.glibc import libc_ver from pip._internal.utils.ui import DownloadProgressProvider
from pip.utils.logging import indent_log from pip._internal.vcs import vcs
from pip.utils.setuptools_build import SETUPTOOLS_SHIM
from pip.utils.temp_dir import TempDirectory
from pip.utils.ui import DownloadProgressProvider
from pip.vcs import vcs
try: try:
import ssl # noqa import ssl # noqa

View file

@ -162,7 +162,8 @@ class HashMissing(HashError):
self.gotten_hash = gotten_hash self.gotten_hash = gotten_hash
def body(self): def body(self):
from pip.utils.hashes import FAVORITE_HASH # Dodge circular import. # Dodge circular import.
from pip._internal.utils.hashes import FAVORITE_HASH
package = None package = None
if self.req: if self.req:

View file

@ -21,22 +21,22 @@ from pip._vendor.requests.exceptions import SSLError
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request from pip._vendor.six.moves.urllib import request as urllib_request
from pip.compat import ipaddress from pip._internal.compat import ipaddress
from pip.download import HAS_TLS, is_url, path_to_url, url_to_path from pip._internal.download import HAS_TLS, is_url, path_to_url, url_to_path
from pip.exceptions import ( from pip._internal.exceptions import (
BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename, BestVersionAlreadyInstalled, DistributionNotFound, InvalidWheelFilename,
UnsupportedWheel UnsupportedWheel
) )
from pip.models import PyPI from pip._internal.models import PyPI
from pip.pep425tags import get_supported from pip._internal.pep425tags import get_supported
from pip.utils import ( from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, cached_property, normalize_path, ARCHIVE_EXTENSIONS, SUPPORTED_EXTENSIONS, cached_property, normalize_path,
splitext splitext
) )
from pip.utils.deprecation import RemovedInPip11Warning from pip._internal.utils.packaging import check_requires_python
from pip.utils.logging import indent_log from pip._internal.wheel import Wheel, wheel_ext
from pip.utils.packaging import check_requires_python
from pip.wheel import Wheel, wheel_ext
__all__ = ['FormatControl', 'fmt_ctl_handle_mutual_exclude', 'PackageFinder'] __all__ = ['FormatControl', 'fmt_ctl_handle_mutual_exclude', 'PackageFinder']
@ -764,7 +764,7 @@ class HTMLPage(object):
url = url.split('#', 1)[0] url = url.split('#', 1)[0]
# Check for VCS schemes that do not support lookup as web pages. # Check for VCS schemes that do not support lookup as web pages.
from pip.vcs import VcsSupport from pip._internal.vcs import VcsSupport
for scheme in VcsSupport.schemes: for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) and url[len(scheme)] in '+:': if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
logger.debug('Cannot look at %s URL %s', scheme, link) logger.debug('Cannot look at %s URL %s', scheme, link)
@ -1046,7 +1046,7 @@ class Link(object):
Determines if this points to an actual artifact (e.g. a tarball) or if Determines if this points to an actual artifact (e.g. a tarball) or if
it points to an "abstract" thing like a path or a VCS location. it points to an "abstract" thing like a path or a VCS location.
""" """
from pip.vcs import vcs from pip._internal.vcs import vcs
if self.scheme in vcs.all_schemes: if self.scheme in vcs.all_schemes:
return False return False

View file

@ -10,8 +10,8 @@ import sysconfig
from distutils import sysconfig as distutils_sysconfig from distutils import sysconfig as distutils_sysconfig
from distutils.command.install import SCHEME_KEYS, install # noqa from distutils.command.install import SCHEME_KEYS, install # noqa
from pip.compat import WINDOWS, expanduser from pip._internal.compat import WINDOWS, expanduser
from pip.utils import appdirs from pip._internal.utils import appdirs
# Application Directories # Application Directories
USER_CACHE_DIR = appdirs.user_cache_dir("pip") USER_CACHE_DIR = appdirs.user_cache_dir("pip")

View file

@ -0,0 +1,4 @@
from pip._internal.models.index import Index, PyPI
__all__ = ["Index", "PyPI"]

View file

@ -9,11 +9,13 @@ from pip._vendor import pkg_resources
from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import RequirementParseError from pip._vendor.pkg_resources import RequirementParseError
from pip.exceptions import InstallationError from pip._internal.exceptions import InstallationError
from pip.req import InstallRequirement from pip._internal.req import InstallRequirement
from pip.req.req_file import COMMENT_RE from pip._internal.req.req_file import COMMENT_RE
from pip.utils import dist_is_editable, get_installed_distributions from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip.utils.deprecation import RemovedInPip11Warning from pip._internal.utils.misc import (
dist_is_editable, get_installed_distributions
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -150,7 +152,7 @@ class FrozenRequirement(object):
def from_dist(cls, dist, dependency_links): def from_dist(cls, dist, dependency_links):
location = os.path.normcase(os.path.abspath(dist.location)) location = os.path.normcase(os.path.abspath(dist.location))
comments = [] comments = []
from pip.vcs import vcs, get_src_requirement from pip._internal.vcs import vcs, get_src_requirement
if dist_is_editable(dist) and vcs.get_backend_name(location): if dist_is_editable(dist) and vcs.get_backend_name(location):
editable = True editable = True
try: try:

View file

@ -6,18 +6,18 @@ import os
from pip._vendor import pkg_resources, requests from pip._vendor import pkg_resources, requests
from pip.compat import expanduser from pip._internal.compat import expanduser
from pip.download import ( from pip._internal.download import (
is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path is_dir_url, is_file_url, is_vcs_url, unpack_url, url_to_path
) )
from pip.exceptions import ( from pip._internal.exceptions import (
DirectoryUrlHashUnsupported, HashUnpinned, InstallationError, DirectoryUrlHashUnsupported, HashUnpinned, InstallationError,
PreviousBuildDirError, VcsHashUnsupported PreviousBuildDirError, VcsHashUnsupported
) )
from pip.utils import display_path, normalize_path from pip._internal.utils.hashes import MissingHashes
from pip.utils.hashes import MissingHashes from pip._internal.utils.logging import indent_log
from pip.utils.logging import indent_log from pip._internal.utils.misc import display_path, normalize_path
from pip.vcs import vcs from pip._internal.vcs import vcs
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -10,7 +10,7 @@ import sysconfig
import warnings import warnings
from collections import OrderedDict from collections import OrderedDict
import pip.utils.glibc import pip._internal.utils.glibc
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -154,7 +154,7 @@ def is_manylinux1_compatible():
pass pass
# Check glibc version. CentOS 5 uses glibc 2.5. # Check glibc version. CentOS 5 uses glibc 2.5.
return pip.utils.glibc.have_compatible_glibc(2, 5) return pip._internal.utils.glibc.have_compatible_glibc(2, 5)
def get_darwin_arches(major, minor, machine): def get_darwin_arches(major, minor, machine):
@ -314,7 +314,4 @@ def get_supported(versions=None, noarch=False, platform=None,
return supported return supported
supported_tags = get_supported()
supported_tags_noarch = get_supported(noarch=True)
implementation_tag = get_impl_tag() implementation_tag = get_impl_tag()

View file

@ -13,10 +13,10 @@ import sys
from pip._vendor.six.moves import filterfalse from pip._vendor.six.moves import filterfalse
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip import cmdoptions from pip._internal import cmdoptions
from pip.download import get_file_content from pip._internal.download import get_file_content
from pip.exceptions import RequirementsFileParseError from pip._internal.exceptions import RequirementsFileParseError
from pip.req.req_install import InstallRequirement from pip._internal.req.req_install import InstallRequirement
__all__ = ['parse_requirements'] __all__ = ['parse_requirements']

View file

@ -21,25 +21,29 @@ from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.packaging.version import Version from pip._vendor.packaging.version import Version
from pip._vendor.pkg_resources import RequirementParseError, parse_requirements from pip._vendor.pkg_resources import RequirementParseError, parse_requirements
import pip.wheel from pip._internal import wheel
from pip.compat import native_str from pip._internal.compat import native_str
from pip.download import is_archive_file, is_url, path_to_url, url_to_path from pip._internal.download import (
from pip.exceptions import InstallationError, UninstallationError is_archive_file, is_url, path_to_url, url_to_path
from pip.locations import PIP_DELETE_MARKER_FILENAME, running_under_virtualenv )
from pip.req.req_uninstall import UninstallPathSet from pip._internal.exceptions import InstallationError, UninstallationError
from pip.utils import ( from pip._internal.locations import (
PIP_DELETE_MARKER_FILENAME, running_under_virtualenv
)
from pip._internal.req.req_uninstall import UninstallPathSet
from pip._internal.utils.deprecation import RemovedInPip11Warning
from pip._internal.utils.hashes import Hashes
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
_make_build_dir, ask_path_exists, backup_dir, call_subprocess, _make_build_dir, ask_path_exists, backup_dir, call_subprocess,
display_path, dist_in_site_packages, dist_in_usersite, ensure_dir, display_path, dist_in_site_packages, dist_in_usersite, ensure_dir,
get_installed_version, is_installable_dir, read_text_file, rmtree get_installed_version, is_installable_dir, read_text_file, rmtree
) )
from pip.utils.deprecation import RemovedInPip11Warning from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
from pip.utils.hashes import Hashes from pip._internal.utils.temp_dir import TempDirectory
from pip.utils.logging import indent_log from pip._internal.utils.ui import open_spinner
from pip.utils.setuptools_build import SETUPTOOLS_SHIM from pip._internal.vcs import vcs
from pip.utils.temp_dir import TempDirectory from pip._internal.wheel import Wheel, move_wheel_files
from pip.utils.ui import open_spinner
from pip.vcs import vcs
from pip.wheel import Wheel, move_wheel_files
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -78,7 +82,7 @@ class InstallRequirement(object):
if link is not None: if link is not None:
self.link = self.original_link = link self.link = self.original_link = link
else: else:
from pip.index import Link from pip._internal.index import Link
self.link = self.original_link = req and req.url and Link(req.url) self.link = self.original_link = req and req.url and Link(req.url)
if extras: if extras:
@ -123,7 +127,7 @@ class InstallRequirement(object):
@classmethod @classmethod
def from_editable(cls, editable_req, comes_from=None, isolated=False, def from_editable(cls, editable_req, comes_from=None, isolated=False,
options=None, wheel_cache=None, constraint=False): options=None, wheel_cache=None, constraint=False):
from pip.index import Link from pip._internal.index import Link
name, url, extras_override = parse_editable(editable_req) name, url, extras_override = parse_editable(editable_req)
if url.startswith('file:'): if url.startswith('file:'):
@ -169,7 +173,7 @@ class InstallRequirement(object):
"""Creates an InstallRequirement from a name, which might be a """Creates an InstallRequirement from a name, which might be a
requirement, directory containing 'setup.py', filename, or URL. requirement, directory containing 'setup.py', filename, or URL.
""" """
from pip.index import Link from pip._internal.index import Link
if is_url(name): if is_url(name):
marker_sep = '; ' marker_sep = '; '
@ -728,8 +732,8 @@ class InstallRequirement(object):
install_options, global_options, prefix=prefix) install_options, global_options, prefix=prefix)
return return
if self.is_wheel: if self.is_wheel:
version = pip.wheel.wheel_version(self.source_dir) version = wheel.wheel_version(self.source_dir)
pip.wheel.check_compatibility(version, self.name) wheel.check_compatibility(version, self.name)
self.move_wheel_files(self.source_dir, root=root, prefix=prefix) self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
self.install_succeeded = True self.install_succeeded = True
@ -1004,7 +1008,7 @@ def parse_editable(editable_req):
.[some_extra] .[some_extra]
""" """
from pip.index import Link from pip._internal.index import Link
url = editable_req url = editable_req

View file

@ -3,9 +3,9 @@ from __future__ import absolute_import
import logging import logging
from collections import OrderedDict, defaultdict from collections import OrderedDict, defaultdict
from pip.exceptions import InstallationError from pip._internal.exceptions import InstallationError
from pip.utils.logging import indent_log from pip._internal.utils.logging import indent_log
from pip.wheel import Wheel from pip._internal.wheel import Wheel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -9,15 +9,15 @@ import sysconfig
from pip._vendor import pkg_resources from pip._vendor import pkg_resources
from pip.compat import WINDOWS, cache_from_source, uses_pycache from pip._internal.compat import WINDOWS, cache_from_source, uses_pycache
from pip.exceptions import UninstallationError from pip._internal.exceptions import UninstallationError
from pip.locations import bin_py, bin_user from pip._internal.locations import bin_py, bin_user
from pip.utils import ( 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, FakeFile, ask, dist_in_usersite, dist_is_local, egg_link_path, is_local,
normalize_path, renames normalize_path, renames
) )
from pip.utils.logging import indent_log from pip._internal.utils.temp_dir import TempDirectory
from pip.utils.temp_dir import TempDirectory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -13,14 +13,14 @@ for sub-dependencies
import logging import logging
from itertools import chain from itertools import chain
from pip.exceptions import ( from pip._internal.exceptions import (
BestVersionAlreadyInstalled, BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors,
DistributionNotFound, HashError, HashErrors, UnsupportedPythonVersion UnsupportedPythonVersion
) )
from pip.req.req_install import InstallRequirement from pip._internal.req.req_install import InstallRequirement
from pip.utils import dist_in_usersite, ensure_dir from pip._internal.utils.logging import indent_log
from pip.utils.logging import indent_log from pip._internal.utils.misc import dist_in_usersite, ensure_dir
from pip.utils.packaging import check_dist_requires_python from pip._internal.utils.packaging import check_dist_requires_python
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -9,7 +9,7 @@ import sys
from pip._vendor.six import PY2, text_type from pip._vendor.six import PY2, text_type
from pip.compat import WINDOWS, expanduser from pip._internal.compat import WINDOWS, expanduser
def user_cache_dir(appname): def user_cache_dir(appname):

View file

@ -39,7 +39,7 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
if issubclass(category, PipDeprecationWarning): if issubclass(category, PipDeprecationWarning):
# We use a specially named logger which will handle all of the # We use a specially named logger which will handle all of the
# deprecation messages for pip. # deprecation messages for pip.
logger = logging.getLogger("pip.deprecations") logger = logging.getLogger("pip._internal.deprecations")
# This is purposely using the % formatter here instead of letting # This is purposely using the % formatter here instead of letting
# the logging module handle the interpolation. This is because we # the logging module handle the interpolation. This is because we

View file

@ -1,7 +1,7 @@
import os import os
import os.path import os.path
from pip.compat import get_path_uid from pip._internal.compat import get_path_uid
def check_path_owner(path): def check_path_owner(path):

View file

@ -4,8 +4,10 @@ import hashlib
from pip._vendor.six import iteritems, iterkeys, itervalues from pip._vendor.six import iteritems, iterkeys, itervalues
from pip.exceptions import HashMismatch, HashMissing, InstallationError from pip._internal.exceptions import (
from pip.utils import read_chunks HashMismatch, HashMissing, InstallationError
)
from pip._internal.utils.misc import read_chunks
# The recommended hash algo of the moment. Change this whenever the state of # The recommended hash algo of the moment. Change this whenever the state of
# the art changes; it won't hurt backward compatibility. # the art changes; it won't hurt backward compatibility.

View file

@ -5,8 +5,8 @@ import logging
import logging.handlers import logging.handlers
import os import os
from pip.compat import WINDOWS from pip._internal.compat import WINDOWS
from pip.utils import ensure_dir from pip._internal.utils.misc import ensure_dir
try: try:
import threading import threading

View file

@ -1,6 +1,5 @@
from __future__ import absolute_import from __future__ import absolute_import
from collections import deque
import contextlib import contextlib
import errno import errno
import io import io
@ -8,26 +7,28 @@ import locale
# we have a submodule named 'logging' which would shadow this if we used the # we have a submodule named 'logging' which would shadow this if we used the
# regular name: # regular name:
import logging as std_logging import logging as std_logging
import re
import os import os
import posixpath import posixpath
import re
import shutil import shutil
import stat import stat
import subprocess import subprocess
import sys import sys
import tarfile import tarfile
import zipfile import zipfile
from collections import deque
from pip.exceptions import InstallationError
from pip.compat import console_to_str, expanduser, stdlib_pkgs
from pip.locations import (
site_packages, user_site, running_under_virtualenv, virtualenv_no_global,
write_delete_marker_file,
)
from pip._vendor import pkg_resources from pip._vendor import pkg_resources
from pip._vendor.six.moves import input
from pip._vendor.six import PY2
from pip._vendor.retrying import retry from pip._vendor.retrying import retry
from pip._vendor.six import PY2
from pip._vendor.six.moves import input
from pip._internal.compat import console_to_str, expanduser, stdlib_pkgs
from pip._internal.exceptions import InstallationError
from pip._internal.locations import (
running_under_virtualenv, site_packages, user_site, virtualenv_no_global,
write_delete_marker_file
)
if PY2: if PY2:
from io import BytesIO as StringIO from io import BytesIO as StringIO
@ -606,7 +607,7 @@ def unpack_file(filename, location, content_type, link):
elif (content_type and content_type.startswith('text/html') and elif (content_type and content_type.startswith('text/html') and
is_svn_page(file_contents(filename))): is_svn_page(file_contents(filename))):
# We don't really care about this # We don't really care about this
from pip.vcs.subversion import Subversion from pip._internal.vcs.subversion import Subversion
Subversion('svn+' + link.url).unpack(location) Subversion('svn+' + link.url).unpack(location)
else: else:
# FIXME: handle? # FIXME: handle?

View file

@ -9,11 +9,11 @@ import sys
from pip._vendor import lockfile from pip._vendor import lockfile
from pip._vendor.packaging import version as packaging_version from pip._vendor.packaging import version as packaging_version
from pip.compat import WINDOWS from pip._internal.compat import WINDOWS
from pip.index import PackageFinder from pip._internal.index import PackageFinder
from pip.locations import USER_CACHE_DIR, running_under_virtualenv from pip._internal.locations import USER_CACHE_DIR, running_under_virtualenv
from pip.utils import ensure_dir, get_installed_version from pip._internal.utils.filesystem import check_path_owner
from pip.utils.filesystem import check_path_owner from pip._internal.utils.misc import ensure_dir, get_installed_version
SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ" SELFCHECK_DATE_FMT = "%Y-%m-%dT%H:%M:%SZ"

View file

@ -7,7 +7,7 @@ from email.parser import FeedParser
from pip._vendor import pkg_resources from pip._vendor import pkg_resources
from pip._vendor.packaging import specifiers, version from pip._vendor.packaging import specifiers, version
from pip import exceptions from pip._internal import exceptions
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -4,7 +4,7 @@ import logging
import os.path import os.path
import tempfile import tempfile
from pip.utils import rmtree from pip._internal.utils.misc import rmtree
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -15,9 +15,9 @@ from pip._vendor.progress.bar import (
from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin
from pip._vendor.progress.spinner import Spinner from pip._vendor.progress.spinner import Spinner
from pip.compat import WINDOWS from pip._internal.compat import WINDOWS
from pip.utils import format_size from pip._internal.utils.logging import get_indentation
from pip.utils.logging import get_indentation from pip._internal.utils.misc import format_size
try: try:
from pip._vendor import colorama from pip._vendor import colorama

View file

@ -9,9 +9,10 @@ import sys
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.exceptions import BadCommand from pip._internal.exceptions import BadCommand
from pip.utils import (display_path, backup_dir, call_subprocess, from pip._internal.utils.misc import (
rmtree, ask_path_exists) display_path, backup_dir, call_subprocess, rmtree, ask_path_exists,
)
__all__ = ['vcs', 'get_src_requirement'] __all__ = ['vcs', 'get_src_requirement']

View file

@ -5,10 +5,10 @@ import os
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.download import path_to_url from pip._internal.download import path_to_url
from pip.utils import display_path, rmtree from pip._internal.utils.misc import display_path, rmtree
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
from pip.vcs import VersionControl, vcs from pip._internal.vcs import VersionControl, vcs
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -7,11 +7,11 @@ from pip._vendor.packaging.version import parse as parse_version
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request from pip._vendor.six.moves.urllib import request as urllib_request
from pip.compat import samefile from pip._internal.compat import samefile
from pip.exceptions import BadCommand from pip._internal.exceptions import BadCommand
from pip.utils import display_path from pip._internal.utils.misc import display_path
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
from pip.vcs import VersionControl, vcs from pip._internal.vcs import VersionControl, vcs
urlsplit = urllib_parse.urlsplit urlsplit = urllib_parse.urlsplit
urlunsplit = urllib_parse.urlunsplit urlunsplit = urllib_parse.urlunsplit

View file

@ -5,10 +5,10 @@ import os
from pip._vendor.six.moves import configparser from pip._vendor.six.moves import configparser
from pip.download import path_to_url from pip._internal.download import path_to_url
from pip.utils import display_path from pip._internal.utils.misc import display_path
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.temp_dir import TempDirectory
from pip.vcs import VersionControl, vcs from pip._internal.vcs import VersionControl, vcs
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -6,10 +6,10 @@ import re
from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip.index import Link from pip._internal.index import Link
from pip.utils import display_path, rmtree from pip._internal.utils.logging import indent_log
from pip.utils.logging import indent_log from pip._internal.utils.misc import display_path, rmtree
from pip.vcs import VersionControl, vcs from pip._internal.vcs import VersionControl, vcs
_svn_xml_url_re = re.compile('url="([^"]+)"') _svn_xml_url_re = re.compile('url="([^"]+)"')
_svn_rev_re = re.compile(r'committed-rev="(\d+)"') _svn_rev_re = re.compile(r'committed-rev="(\d+)"')
@ -163,7 +163,7 @@ class Subversion(VersionControl):
return self._get_svn_url_rev(location)[0] return self._get_svn_url_rev(location)[0]
def _get_svn_url_rev(self, location): def _get_svn_url_rev(self, location):
from pip.exceptions import InstallationError from pip._internal.exceptions import InstallationError
entries_path = os.path.join(location, self.dirname, 'entries') entries_path = os.path.join(location, self.dirname, 'entries')
if os.path.exists(entries_path): if os.path.exists(entries_path):

View file

@ -23,18 +23,21 @@ from pip._vendor.distlib.scripts import ScriptMaker
from pip._vendor.packaging.utils import canonicalize_name from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.six import StringIO from pip._vendor.six import StringIO
import pip.index from pip._internal import pep425tags
from pip import pep425tags from pip._internal.download import path_to_url, unpack_url
from pip.download import path_to_url, unpack_url from pip._internal.exceptions import (
from pip.exceptions import (
InstallationError, InvalidWheelFilename, UnsupportedWheel InstallationError, InvalidWheelFilename, UnsupportedWheel
) )
from pip.locations import PIP_DELETE_MARKER_FILENAME, distutils_scheme from pip._internal.locations import (
from pip.utils import call_subprocess, captured_stdout, ensure_dir, read_chunks PIP_DELETE_MARKER_FILENAME, distutils_scheme
from pip.utils.logging import indent_log )
from pip.utils.setuptools_build import SETUPTOOLS_SHIM from pip._internal.utils.logging import indent_log
from pip.utils.temp_dir import TempDirectory from pip._internal.utils.misc import (
from pip.utils.ui import open_spinner call_subprocess, captured_stdout, ensure_dir, read_chunks
)
from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.ui import open_spinner
wheel_ext = '.whl' wheel_ext = '.whl'
@ -520,14 +523,14 @@ class Wheel(object):
None is the wheel is not supported. None is the wheel is not supported.
""" """
if tags is None: # for mock if tags is None: # for mock
tags = pep425tags.supported_tags tags = pep425tags.get_supported()
indexes = [tags.index(c) for c in self.file_tags if c in tags] indexes = [tags.index(c) for c in self.file_tags if c in tags]
return min(indexes) if indexes else None return min(indexes) if indexes else None
def supported(self, tags=None): def supported(self, tags=None):
"""Is this wheel supported on this system?""" """Is this wheel supported on this system?"""
if tags is None: # for mock if tags is None: # for mock
tags = pep425tags.supported_tags tags = pep425tags.get_supported()
return bool(set(tags).intersection(self.file_tags)) return bool(set(tags).intersection(self.file_tags))
@ -618,8 +621,8 @@ class WheelBuilder(object):
def _install_build_reqs(self, reqs, prefix): def _install_build_reqs(self, reqs, prefix):
# Local import to avoid circular import (wheel <-> req_install) # Local import to avoid circular import (wheel <-> req_install)
from pip.req.req_install import InstallRequirement from pip._internal.req.req_install import InstallRequirement
from pip.index import FormatControl from pip._internal.index import FormatControl
# Ignore the --no-binary option when installing the build system, so # Ignore the --no-binary option when installing the build system, so
# we don't recurse trying to build a self-hosting build system. # we don't recurse trying to build a self-hosting build system.
finder = copy.copy(self.finder) finder = copy.copy(self.finder)
@ -727,6 +730,8 @@ class WheelBuilder(object):
newly built wheel, in preparation for installation. newly built wheel, in preparation for installation.
:return: True if all the wheels built correctly. :return: True if all the wheels built correctly.
""" """
from pip._internal import index
building_is_possible = self._wheel_dir or ( building_is_possible = self._wheel_dir or (
autobuilding and self.wheel_cache.cache_dir autobuilding and self.wheel_cache.cache_dir
) )
@ -752,11 +757,11 @@ class WheelBuilder(object):
if autobuilding: if autobuilding:
link = req.link link = req.link
base, ext = link.splitext() base, ext = link.splitext()
if pip.index.egg_info_matches(base, None, link) is None: if index.egg_info_matches(base, None, link) is None:
# Doesn't look like a package - don't autobuild a wheel # Doesn't look like a package - don't autobuild a wheel
# because we'll have no way to lookup the result sanely # because we'll have no way to lookup the result sanely
continue continue
if "binary" not in pip.index.fmt_ctl_formats( if "binary" not in index.fmt_ctl_formats(
self.finder.format_control, self.finder.format_control,
canonicalize_name(req.name)): canonicalize_name(req.name)):
logger.info( logger.info(
@ -813,8 +818,7 @@ class WheelBuilder(object):
self.preparer.build_dir self.preparer.build_dir
) )
# Update the link for this. # Update the link for this.
req.link = pip.index.Link( req.link = index.Link(path_to_url(wheel_file))
path_to_url(wheel_file))
assert req.link.is_wheel assert req.link.is_wheel
# extract the wheel into the dir # extract the wheel into the dir
unpack_url( unpack_url(

Some files were not shown because too many files have changed in this diff Show more