mirror of https://github.com/pypa/pip
Merge branch 'master' into mypy/infrastructure
This commit is contained in:
commit
11451c54ec
|
@ -1,2 +1,2 @@
|
|||
ignore-paths:
|
||||
- pip/_vendor/
|
||||
- src/pip/_vendor/
|
||||
|
|
2
.mailmap
2
.mailmap
|
@ -27,6 +27,8 @@ Markus Hametner <fin+github@xbhd.org
|
|||
Masklinn <bitbucket.org@masklinn.net>
|
||||
Matthew Iversen <teh.ivo@gmail.com> <teh.ivo@gmail.com>
|
||||
<pnasrat@gmail.com> <pnasrat@googlemail.com>
|
||||
Pradyun Gedam <pradyunsg@gmail.com> <pradyunsg@users.noreply.github.com>
|
||||
Pradyun Gedam <pradyunsg@gmail.com>
|
||||
Preston Holmes <preston@ptone.com>
|
||||
Przemek Wrzos <hetmankp@none>
|
||||
<hodgestar@gmail.com> <hodgestar+hg@gmail.com>
|
||||
|
|
21
.travis.yml
21
.travis.yml
|
@ -1,5 +1,6 @@
|
|||
language: python
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
@ -8,27 +9,29 @@ matrix:
|
|||
- env: TOXENV=lint-py3
|
||||
- env: TOXENV=mypy
|
||||
- env: TOXENV=packaging
|
||||
|
||||
# PyPy jobs start first -- they are the slowest
|
||||
- env: TOXENV=pypy
|
||||
python: pypy
|
||||
- env: TOXENV=pypy3
|
||||
python: pypy3
|
||||
# Latest Stable CPython jobs
|
||||
- env: TOXENV=py27
|
||||
python: 2.7
|
||||
- env: TOXENV=py36
|
||||
python: 3.6
|
||||
# All the other Py3 versions
|
||||
- env: TOXENV=py33
|
||||
python: 3.3
|
||||
- env: TOXENV=py34
|
||||
python: 3.4
|
||||
- env: TOXENV=py35
|
||||
python: 3.5
|
||||
- env: TOXENV=py36
|
||||
python: 3.6
|
||||
# Nightly Python goes last
|
||||
- env: TOXENV=py37
|
||||
python: nightly
|
||||
- env: TOXENV=pypy
|
||||
python: pypy-5.4
|
||||
- env: "TOXENV=py27 VENDOR=no WHEELS=yes"
|
||||
python: 2.7
|
||||
- env: "TOXENV=py36 VENDOR=no WHEELS=yes"
|
||||
python: 3.6
|
||||
allow_failures:
|
||||
- python: nightly
|
||||
- python: pypy3
|
||||
|
||||
install: travis_retry .travis/install.sh
|
||||
script: .travis/run.sh
|
||||
|
|
|
@ -2,49 +2,11 @@
|
|||
set -e
|
||||
set -x
|
||||
|
||||
# We want to create the virtual environment here, but not actually run anything
|
||||
tox --notest
|
||||
|
||||
# If we have a VENDOR=no then we want to reinstall pip into the virtual
|
||||
# environment without the vendor directory included as well as install the
|
||||
# dependencies we need installed.
|
||||
if [[ $VENDOR = "no" ]]; then
|
||||
# Install our dependencies if we're not installing from wheels
|
||||
if [[ $WHEELS != "yes" ]]; then
|
||||
.tox/$TOXENV/bin/pip install -r pip/_vendor/vendor.txt --no-deps
|
||||
fi
|
||||
|
||||
# Install our dependencies if we're installing from wheels
|
||||
if [[ $WHEELS = "yes" ]]; then
|
||||
mkdir -p /tmp/wheels
|
||||
pip wheel --wheel-dir /tmp/wheels --no-deps -r pip/_vendor/vendor.txt
|
||||
cp /tmp/wheels/* `echo .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/`
|
||||
fi
|
||||
|
||||
# Remove the vendored dependencies from within the installed pip inside of
|
||||
# our installed copy of pip.
|
||||
find .tox/$TOXENV/lib/python*/site-packages/pip/_vendor -d \
|
||||
-not -regex '.*/pip/_vendor/__init__\.py$' \
|
||||
-not -regex '.*/pip/_vendor$' \
|
||||
-exec rm -rf {} \;
|
||||
|
||||
# Patch our installed pip/_vendor/__init__.py so that it knows to look for
|
||||
# the vendored dependencies instead of only looking for the vendored.
|
||||
sed -i 's/DEBUNDLED = False/DEBUNDLED = True/' \
|
||||
.tox/$TOXENV/lib/python*/site-packages/pip/_vendor/__init__.py
|
||||
|
||||
# Test to make sure that we successfully installed without vendoring
|
||||
if [ -f .tox/$TOXENV/lib/python*/site-packages/pip/_vendor/six.py ]; then
|
||||
echo "Did not successfully unvendor"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $TOXENV == py* ]]; then
|
||||
# Run unit tests
|
||||
tox -- -m unit
|
||||
# Run integration tests
|
||||
tox -- -m integration -n 8 --duration=5
|
||||
tox -- -m integration -n 4 --duration=5
|
||||
else
|
||||
# Run once
|
||||
tox
|
||||
|
|
|
@ -3,19 +3,19 @@ include LICENSE.txt
|
|||
include NEWS.rst
|
||||
include README.rst
|
||||
include pyproject.toml
|
||||
include pip/_vendor/README.rst
|
||||
include pip/_vendor/vendor.txt
|
||||
include src/pip/_vendor/README.rst
|
||||
include src/pip/_vendor/vendor.txt
|
||||
|
||||
exclude .coveragerc
|
||||
exclude .mailmap
|
||||
exclude .travis.yml
|
||||
exclude .landscape.yml
|
||||
exclude pip/_vendor/Makefile
|
||||
exclude src/pip/_vendor/Makefile
|
||||
exclude tox.ini
|
||||
exclude dev-requirements.txt
|
||||
exclude appveyor.yml
|
||||
|
||||
recursive-include pip/_vendor *.pem
|
||||
recursive-include src/pip/_vendor *.pem
|
||||
recursive-include docs Makefile *.rst *.py *.bat
|
||||
|
||||
exclude pip/_vendor/six
|
||||
|
|
|
@ -5,6 +5,7 @@ pytest-catchlog
|
|||
pytest-rerunfailures
|
||||
pytest-timeout
|
||||
pytest-xdist
|
||||
pyyaml
|
||||
mock<1.1
|
||||
scripttest>=1.3
|
||||
https://github.com/pypa/virtualenv/archive/master.zip#egg=virtualenv
|
||||
|
|
|
@ -6,9 +6,9 @@ from docutils import nodes
|
|||
from docutils.parsers import rst
|
||||
from docutils.statemachine import ViewList
|
||||
from textwrap import dedent
|
||||
from pip.commands import commands_dict as commands
|
||||
from pip import cmdoptions
|
||||
from pip.utils import get_prog
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.commands import commands_dict as commands
|
||||
from pip._internal.utils.misc import get_prog
|
||||
|
||||
|
||||
class PipCommandUsage(rst.Directive):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
pip no longer passes global options from one package to later packages in the same requirement file.
|
|
@ -0,0 +1 @@
|
|||
Report the line which caused the hash error when using requirement files.
|
|
@ -0,0 +1 @@
|
|||
Support build-numbers in wheel versions and support sorting with build-numbers.
|
|
@ -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.
|
|
@ -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.
|
|
@ -1,4 +0,0 @@
|
|||
from pip.models.index import Index, PyPI
|
||||
|
||||
|
||||
__all__ = ["Index", "PyPI"]
|
|
@ -25,7 +25,7 @@ follow_imports = skip
|
|||
ignore_errors = True
|
||||
|
||||
[tool:pytest]
|
||||
addopts = --ignore pip/_vendor --ignore tests/tests_cache
|
||||
addopts = --ignore src/pip/_vendor --ignore tests/tests_cache
|
||||
|
||||
[bdist_wheel]
|
||||
universal=1
|
||||
|
|
14
setup.py
14
setup.py
|
@ -38,7 +38,7 @@ tests_require = [
|
|||
|
||||
setup(
|
||||
name="pip",
|
||||
version=find_version("pip", "__init__.py"),
|
||||
version=find_version("src", "pip", "__init__.py"),
|
||||
description="The PyPA recommended tool for installing Python packages.",
|
||||
long_description=long_description,
|
||||
classifiers=[
|
||||
|
@ -60,7 +60,11 @@ setup(
|
|||
author_email='python-virtualenv@groups.google.com',
|
||||
url='https://pip.pypa.io/',
|
||||
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={
|
||||
"pip._vendor.certifi": ["*.pem"],
|
||||
"pip._vendor.requests": ["*.pem"],
|
||||
|
@ -69,9 +73,9 @@ setup(
|
|||
},
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"pip=pip:main",
|
||||
"pip%s=pip:main" % sys.version[:1],
|
||||
"pip%s=pip:main" % sys.version[:3],
|
||||
"pip=pip._internal:main",
|
||||
"pip%s=pip._internal:main" % sys.version[:1],
|
||||
"pip%s=pip._internal:main" % sys.version[:3],
|
||||
],
|
||||
},
|
||||
tests_require=tests_require,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
__version__ = "10.0.0.dev0"
|
|
@ -13,7 +13,7 @@ if __package__ == '':
|
|||
path = os.path.dirname(os.path.dirname(__file__))
|
||||
sys.path.insert(0, path)
|
||||
|
||||
import pip # noqa
|
||||
from pip._internal import main as _main # noqa
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(pip.main())
|
||||
sys.exit(_main())
|
|
@ -40,13 +40,17 @@ else:
|
|||
else:
|
||||
securetransport.inject_into_urllib3()
|
||||
|
||||
from pip.exceptions import CommandError, PipError
|
||||
from pip.utils import get_installed_distributions, get_prog
|
||||
from pip.utils import deprecation
|
||||
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 import __version__
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.exceptions import CommandError, PipError
|
||||
from pip._internal.utils.misc import get_installed_distributions, get_prog
|
||||
from pip._internal.utils import deprecation
|
||||
from pip._internal.vcs import git, mercurial, subversion, bazaar # noqa
|
||||
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 (
|
||||
InsecureRequestWarning,
|
||||
)
|
||||
|
@ -61,12 +65,8 @@ if MYPY_CHECK_RUNNING:
|
|||
# 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 # noqa
|
||||
cmdoptions = pip.cmdoptions # type: Any
|
||||
|
||||
# The version as used in the setup.py and the docs conf.py
|
||||
__version__ = "10.0.0.dev0"
|
||||
|
||||
# import pip._internal.cmdoptions
|
||||
# cmdoptions = pip._internal.cmdoptions
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -253,7 +253,3 @@ def main(args=None):
|
|||
logger.debug("Ignoring error %s when setting locale", e)
|
||||
command = commands_dict[cmd_name](isolated=check_isolated(cmd_args))
|
||||
return command.main(cmd_args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -8,25 +8,28 @@ import os
|
|||
import sys
|
||||
import warnings
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
|
||||
from pip.compat import WINDOWS
|
||||
from pip.download import PipSession
|
||||
from pip.exceptions import (
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.baseparser import (
|
||||
ConfigOptionParser, UpdatingDefaultsHelpFormatter
|
||||
)
|
||||
from pip._internal.compat import WINDOWS
|
||||
from pip._internal.download import PipSession
|
||||
from pip._internal.exceptions import (
|
||||
BadCommand, CommandError, InstallationError, PreviousBuildDirError,
|
||||
UninstallationError
|
||||
)
|
||||
from pip.index import PackageFinder
|
||||
from pip.locations import running_under_virtualenv
|
||||
from pip.req import InstallRequirement, parse_requirements
|
||||
from pip.status_codes import (
|
||||
from pip._internal.index import PackageFinder
|
||||
from pip._internal.locations import running_under_virtualenv
|
||||
from pip._internal.req import InstallRequirement, parse_requirements
|
||||
from pip._internal.status_codes import (
|
||||
ERROR, PREVIOUS_BUILD_DIR_ERROR, SUCCESS, UNKNOWN_ERROR,
|
||||
VIRTUALENV_NOT_FOUND
|
||||
)
|
||||
from pip.utils import deprecation, get_prog, normalize_path
|
||||
from pip.utils.logging import IndentingFormatter
|
||||
from pip.utils.outdated import pip_version_check
|
||||
from pip.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.utils import deprecation
|
||||
from pip._internal.utils.logging import IndentingFormatter
|
||||
from pip._internal.utils.misc import get_prog, normalize_path
|
||||
from pip._internal.utils.outdated import pip_version_check
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Optional
|
||||
|
@ -133,7 +136,7 @@ class Command(object):
|
|||
"disable_existing_loggers": False,
|
||||
"filters": {
|
||||
"exclude_warnings": {
|
||||
"()": "pip.utils.logging.MaxLevelFilter",
|
||||
"()": "pip._internal.utils.logging.MaxLevelFilter",
|
||||
"level": logging.WARNING,
|
||||
},
|
||||
},
|
||||
|
@ -146,20 +149,24 @@ class Command(object):
|
|||
"handlers": {
|
||||
"console": {
|
||||
"level": level,
|
||||
"class": "pip.utils.logging.ColorizedStreamHandler",
|
||||
"class":
|
||||
"pip._internal.utils.logging.ColorizedStreamHandler",
|
||||
"stream": self.log_streams[0],
|
||||
"filters": ["exclude_warnings"],
|
||||
"formatter": "indent",
|
||||
},
|
||||
"console_errors": {
|
||||
"level": "WARNING",
|
||||
"class": "pip.utils.logging.ColorizedStreamHandler",
|
||||
"class":
|
||||
"pip._internal.utils.logging.ColorizedStreamHandler",
|
||||
"stream": self.log_streams[1],
|
||||
"formatter": "indent",
|
||||
},
|
||||
"user_log": {
|
||||
"level": "DEBUG",
|
||||
"class": "pip.utils.logging.BetterRotatingFileHandler",
|
||||
"class":
|
||||
("pip._internal.utils.logging"
|
||||
".BetterRotatingFileHandler"),
|
||||
"filename": options.log or "/dev/null",
|
||||
"delay": True,
|
||||
"formatter": "indent",
|
|
@ -9,8 +9,8 @@ from distutils.util import strtobool
|
|||
|
||||
from pip._vendor.six import string_types
|
||||
|
||||
from pip.configuration import Configuration
|
||||
from pip.utils import get_terminal_size
|
||||
from pip._internal.configuration import Configuration
|
||||
from pip._internal.utils.misc import get_terminal_size
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -8,10 +8,10 @@ import os
|
|||
|
||||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
|
||||
import pip.index
|
||||
from pip.compat import expanduser
|
||||
from pip.download import path_to_url
|
||||
from pip.wheel import InvalidWheelFilename, Wheel
|
||||
from pip._internal import index
|
||||
from pip._internal.compat import expanduser
|
||||
from pip._internal.download import path_to_url
|
||||
from pip._internal.wheel import InvalidWheelFilename, Wheel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Cache(object):
|
|||
return []
|
||||
|
||||
canonical_name = canonicalize_name(package_name)
|
||||
formats = pip.index.fmt_ctl_formats(
|
||||
formats = index.fmt_ctl_formats(
|
||||
self.format_control, canonical_name
|
||||
)
|
||||
if not self.allowed_formats.intersection(formats):
|
||||
|
@ -100,7 +100,7 @@ class Cache(object):
|
|||
root = self.get_path_for_link(link)
|
||||
path = os.path.join(root, candidate)
|
||||
|
||||
return pip.index.Link(path_to_url(path))
|
||||
return index.Link(path_to_url(path))
|
||||
|
||||
|
||||
class WheelCache(Cache):
|
|
@ -13,13 +13,13 @@ import warnings
|
|||
from functools import partial
|
||||
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
|
||||
)
|
||||
from pip.locations import USER_CACHE_DIR, src_prefix
|
||||
from pip.models import PyPI
|
||||
from pip.utils.hashes import STRONG_HASHES
|
||||
from pip.utils.ui import BAR_TYPES
|
||||
from pip._internal.locations import USER_CACHE_DIR, src_prefix
|
||||
from pip._internal.models import PyPI
|
||||
from pip._internal.utils.hashes import STRONG_HASHES
|
||||
from pip._internal.utils.ui import BAR_TYPES
|
||||
|
||||
|
||||
def make_option_group(group, parser):
|
|
@ -3,24 +3,25 @@ Package containing all pip commands
|
|||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from pip.commands.completion import CompletionCommand
|
||||
from pip.commands.configuration import ConfigurationCommand
|
||||
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 pip.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.commands.completion import CompletionCommand
|
||||
from pip._internal.commands.configuration import ConfigurationCommand
|
||||
from pip._internal.commands.download import DownloadCommand
|
||||
from pip._internal.commands.freeze import FreezeCommand
|
||||
from pip._internal.commands.hash import HashCommand
|
||||
from pip._internal.commands.help import HelpCommand
|
||||
from pip._internal.commands.list import ListCommand
|
||||
from pip._internal.commands.check import CheckCommand
|
||||
from pip._internal.commands.search import SearchCommand
|
||||
from pip._internal.commands.show import ShowCommand
|
||||
from pip._internal.commands.install import InstallCommand
|
||||
from pip._internal.commands.uninstall import UninstallCommand
|
||||
from pip._internal.commands.wheel import WheelCommand
|
||||
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import List, Type
|
||||
from pip.basecommand import Command
|
||||
from pip._internal.basecommand import Command
|
||||
|
||||
commands_order = [
|
||||
InstallCommand,
|
|
@ -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 pip._internal.basecommand import Command
|
||||
from pip._internal.operations.check import check_requirements
|
||||
from pip._internal.utils.misc import get_installed_distributions
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -3,7 +3,7 @@ from __future__ import absolute_import
|
|||
import sys
|
||||
import textwrap
|
||||
|
||||
from pip.basecommand import Command
|
||||
from pip._internal.basecommand import Command
|
||||
|
||||
BASE_COMPLETION = """
|
||||
# pip %(shell)s completion start%(script)s# pip %(shell)s completion end
|
|
@ -2,12 +2,12 @@ import logging
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
from pip.basecommand import Command
|
||||
from pip.configuration import Configuration, kinds
|
||||
from pip.exceptions import PipError
|
||||
from pip.locations import venv_config_file
|
||||
from pip.status_codes import ERROR, SUCCESS
|
||||
from pip.utils import get_prog
|
||||
from pip._internal.basecommand import Command
|
||||
from pip._internal.configuration import Configuration, kinds
|
||||
from pip._internal.exceptions import PipError
|
||||
from pip._internal.locations import venv_config_file
|
||||
from pip._internal.status_codes import ERROR, SUCCESS
|
||||
from pip._internal.utils.misc import get_prog
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -3,16 +3,16 @@ from __future__ import absolute_import
|
|||
import logging
|
||||
import os
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.basecommand import RequirementCommand
|
||||
from pip.exceptions import CommandError
|
||||
from pip.index import FormatControl
|
||||
from pip.operations.prepare import RequirementPreparer
|
||||
from pip.req import RequirementSet
|
||||
from pip.resolve import Resolver
|
||||
from pip.utils import ensure_dir, normalize_path
|
||||
from pip.utils.filesystem import check_path_owner
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.basecommand import RequirementCommand
|
||||
from pip._internal.exceptions import CommandError
|
||||
from pip._internal.index import FormatControl
|
||||
from pip._internal.operations.prepare import RequirementPreparer
|
||||
from pip._internal.req import RequirementSet
|
||||
from pip._internal.resolve import Resolver
|
||||
from pip._internal.utils.filesystem import check_path_owner
|
||||
from pip._internal.utils.misc import ensure_dir, normalize_path
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -2,11 +2,11 @@ from __future__ import absolute_import
|
|||
|
||||
import sys
|
||||
|
||||
import pip
|
||||
from pip.basecommand import Command
|
||||
from pip.cache import WheelCache
|
||||
from pip.compat import stdlib_pkgs
|
||||
from pip.operations.freeze import freeze
|
||||
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
|
||||
|
||||
DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel'}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class FreezeCommand(Command):
|
|||
self.parser.insert_option_group(0, self.cmd_opts)
|
||||
|
||||
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)
|
||||
skip = set(stdlib_pkgs)
|
||||
if not options.freeze_all:
|
|
@ -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 pip._internal.basecommand import Command
|
||||
from pip._internal.status_codes import ERROR
|
||||
from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
|
||||
from pip._internal.utils.misc import read_chunks
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from pip.basecommand import SUCCESS, Command
|
||||
from pip.exceptions import CommandError
|
||||
from pip._internal.basecommand import SUCCESS, Command
|
||||
from pip._internal.exceptions import CommandError
|
||||
|
||||
|
||||
class HelpCommand(Command):
|
||||
|
@ -13,7 +13,7 @@ class HelpCommand(Command):
|
|||
ignore_require_venv = True
|
||||
|
||||
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:
|
||||
# 'pip help' with no args is handled by pip.__init__.parseopt()
|
|
@ -6,21 +6,21 @@ import operator
|
|||
import os
|
||||
import shutil
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.basecommand import RequirementCommand
|
||||
from pip.cache import WheelCache
|
||||
from pip.exceptions import (
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.basecommand import RequirementCommand
|
||||
from pip._internal.cache import WheelCache
|
||||
from pip._internal.exceptions import (
|
||||
CommandError, InstallationError, PreviousBuildDirError
|
||||
)
|
||||
from pip.locations import distutils_scheme, virtualenv_no_global
|
||||
from pip.operations.prepare import RequirementPreparer
|
||||
from pip.req import RequirementSet
|
||||
from pip.resolve import Resolver
|
||||
from pip.status_codes import ERROR
|
||||
from pip.utils import ensure_dir, get_installed_version
|
||||
from pip.utils.filesystem import check_path_owner
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.wheel import WheelBuilder
|
||||
from pip._internal.locations import distutils_scheme, virtualenv_no_global
|
||||
from pip._internal.operations.prepare import RequirementPreparer
|
||||
from pip._internal.req import RequirementSet
|
||||
from pip._internal.resolve import Resolver
|
||||
from pip._internal.status_codes import ERROR
|
||||
from pip._internal.utils.filesystem import check_path_owner
|
||||
from pip._internal.utils.misc import ensure_dir, get_installed_version
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.wheel import WheelBuilder
|
||||
|
||||
try:
|
||||
import wheel
|
|
@ -7,13 +7,15 @@ import warnings
|
|||
from pip._vendor import six
|
||||
from pip._vendor.six.moves import zip_longest
|
||||
|
||||
from pip.basecommand import Command
|
||||
from pip.cmdoptions import index_group, make_option_group
|
||||
from pip.exceptions import CommandError
|
||||
from pip.index import PackageFinder
|
||||
from pip.utils import dist_is_editable, get_installed_distributions
|
||||
from pip.utils.deprecation import RemovedInPip11Warning
|
||||
from pip.utils.packaging import get_installer
|
||||
from pip._internal.basecommand import Command
|
||||
from pip._internal.cmdoptions import index_group, make_option_group
|
||||
from pip._internal.exceptions import CommandError
|
||||
from pip._internal.index import PackageFinder
|
||||
from pip._internal.utils.deprecation import RemovedInPip11Warning
|
||||
from pip._internal.utils.misc import (
|
||||
dist_is_editable, get_installed_distributions
|
||||
)
|
||||
from pip._internal.utils.packaging import get_installer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -11,13 +11,13 @@ from pip._vendor.packaging.version import parse as parse_version
|
|||
# why we ignore the type on this import
|
||||
from pip._vendor.six.moves import xmlrpc_client # type: ignore
|
||||
|
||||
from pip.basecommand import SUCCESS, Command
|
||||
from pip.download import PipXmlrpcTransport
|
||||
from pip.exceptions import CommandError
|
||||
from pip.models import PyPI
|
||||
from pip.status_codes import NO_MATCHES_FOUND
|
||||
from pip.utils import get_terminal_size
|
||||
from pip.utils.logging import indent_log
|
||||
from pip._internal.basecommand import SUCCESS, Command
|
||||
from pip._internal.download import PipXmlrpcTransport
|
||||
from pip._internal.exceptions import CommandError
|
||||
from pip._internal.models import PyPI
|
||||
from pip._internal.status_codes import NO_MATCHES_FOUND
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.utils.misc import get_terminal_size
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -7,8 +7,8 @@ from email.parser import FeedParser
|
|||
from pip._vendor import pkg_resources
|
||||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
|
||||
from pip.basecommand import Command
|
||||
from pip.status_codes import ERROR, SUCCESS
|
||||
from pip._internal.basecommand import Command
|
||||
from pip._internal.status_codes import ERROR, SUCCESS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -2,9 +2,9 @@ from __future__ import absolute_import
|
|||
|
||||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
|
||||
from pip.basecommand import Command
|
||||
from pip.exceptions import InstallationError
|
||||
from pip.req import InstallRequirement, parse_requirements
|
||||
from pip._internal.basecommand import Command
|
||||
from pip._internal.exceptions import InstallationError
|
||||
from pip._internal.req import InstallRequirement, parse_requirements
|
||||
|
||||
|
||||
class UninstallCommand(Command):
|
|
@ -4,16 +4,16 @@ from __future__ import absolute_import
|
|||
import logging
|
||||
import os
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.basecommand import RequirementCommand
|
||||
from pip.cache import WheelCache
|
||||
from pip.exceptions import CommandError, PreviousBuildDirError
|
||||
from pip.operations.prepare import RequirementPreparer
|
||||
from pip.req import RequirementSet
|
||||
from pip.resolve import Resolver
|
||||
from pip.utils import import_or_raise
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.wheel import WheelBuilder
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.basecommand import RequirementCommand
|
||||
from pip._internal.cache import WheelCache
|
||||
from pip._internal.exceptions import CommandError, PreviousBuildDirError
|
||||
from pip._internal.operations.prepare import RequirementPreparer
|
||||
from pip._internal.req import RequirementSet
|
||||
from pip._internal.resolve import Resolver
|
||||
from pip._internal.utils.misc import import_or_raise
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.wheel import WheelBuilder
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -17,13 +17,13 @@ import os
|
|||
from pip._vendor import six
|
||||
from pip._vendor.six.moves import configparser
|
||||
|
||||
from pip.exceptions import ConfigurationError
|
||||
from pip.locations import (
|
||||
from pip._internal.exceptions import ConfigurationError
|
||||
from pip._internal.locations import (
|
||||
legacy_config_file, new_config_file, running_under_virtualenv,
|
||||
site_config_files, venv_config_file
|
||||
)
|
||||
from pip.utils import ensure_dir, enum
|
||||
from pip.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.utils.misc import ensure_dir, enum
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Any, Dict, Iterable, List, NewType, Optional, Tuple
|
|
@ -30,22 +30,22 @@ from pip._vendor.six.moves.urllib import request as urllib_request
|
|||
from pip._vendor.six.moves.urllib.parse import unquote as urllib_unquote
|
||||
|
||||
import pip
|
||||
from pip.exceptions import HashMismatch, InstallationError
|
||||
from pip.locations import write_delete_marker_file
|
||||
from pip.models import PyPI
|
||||
from pip.utils import (
|
||||
from pip._internal.exceptions import HashMismatch, InstallationError
|
||||
from pip._internal.locations import write_delete_marker_file
|
||||
from pip._internal.models import PyPI
|
||||
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,
|
||||
display_path, format_size, get_installed_version, rmtree, splitext,
|
||||
unpack_file
|
||||
)
|
||||
from pip.utils.encoding import auto_decode
|
||||
from pip.utils.filesystem import check_path_owner
|
||||
from pip.utils.glibc import libc_ver
|
||||
from pip.utils.logging import indent_log
|
||||
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
|
||||
from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.utils.ui import DownloadProgressProvider
|
||||
from pip._internal.vcs import vcs
|
||||
|
||||
try:
|
||||
import ssl # noqa
|
|
@ -162,7 +162,8 @@ class HashMissing(HashError):
|
|||
self.gotten_hash = gotten_hash
|
||||
|
||||
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
|
||||
if self.req:
|
|
@ -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 request as urllib_request
|
||||
|
||||
from pip.compat import ipaddress
|
||||
from pip.download import HAS_TLS, is_url, path_to_url, url_to_path
|
||||
from pip.exceptions import (
|
||||
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,
|
||||
UnsupportedWheel
|
||||
)
|
||||
from pip.models import PyPI
|
||||
from pip.pep425tags import get_supported
|
||||
from pip.utils import (
|
||||
from pip._internal.models import PyPI
|
||||
from pip._internal.pep425tags import get_supported
|
||||
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,
|
||||
splitext
|
||||
)
|
||||
from pip.utils.deprecation import RemovedInPip11Warning
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.packaging import check_requires_python
|
||||
from pip.wheel import Wheel, wheel_ext
|
||||
from pip._internal.utils.packaging import check_requires_python
|
||||
from pip._internal.wheel import Wheel, wheel_ext
|
||||
|
||||
__all__ = ['FormatControl', 'fmt_ctl_handle_mutual_exclude', 'PackageFinder']
|
||||
|
||||
|
@ -278,6 +278,7 @@ class PackageFinder(object):
|
|||
with the same version, would have to be considered equal
|
||||
"""
|
||||
support_num = len(self.valid_tags)
|
||||
build_tag = tuple()
|
||||
if candidate.location.is_wheel:
|
||||
# can raise InvalidWheelFilename
|
||||
wheel = Wheel(candidate.location.filename)
|
||||
|
@ -287,9 +288,13 @@ class PackageFinder(object):
|
|||
"can't be sorted." % wheel.filename
|
||||
)
|
||||
pri = -(wheel.support_index_min(self.valid_tags))
|
||||
if wheel.build_tag is not None:
|
||||
match = re.match('^(\d+)(.*)$', wheel.build_tag)
|
||||
build_tag_groups = match.groups()
|
||||
build_tag = (int(build_tag_groups[0]), build_tag_groups[1])
|
||||
else: # sdist
|
||||
pri = -(support_num)
|
||||
return (candidate.version, pri)
|
||||
return (candidate.version, build_tag, pri)
|
||||
|
||||
def _validate_secure_origin(self, logger, location):
|
||||
# Determine if this url used a secure transport mechanism
|
||||
|
@ -759,7 +764,7 @@ class HTMLPage(object):
|
|||
url = url.split('#', 1)[0]
|
||||
|
||||
# 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:
|
||||
if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
|
||||
logger.debug('Cannot look at %s URL %s', scheme, link)
|
||||
|
@ -1041,7 +1046,7 @@ class Link(object):
|
|||
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.
|
||||
"""
|
||||
from pip.vcs import vcs
|
||||
from pip._internal.vcs import vcs
|
||||
|
||||
if self.scheme in vcs.all_schemes:
|
||||
return False
|
|
@ -10,8 +10,8 @@ import sysconfig
|
|||
from distutils import sysconfig as distutils_sysconfig
|
||||
from distutils.command.install import SCHEME_KEYS, install # type: ignore
|
||||
|
||||
from pip.compat import WINDOWS, expanduser
|
||||
from pip.utils import appdirs
|
||||
from pip._internal.compat import WINDOWS, expanduser
|
||||
from pip._internal.utils import appdirs
|
||||
|
||||
|
||||
# Application Directories
|
|
@ -0,0 +1,4 @@
|
|||
from pip._internal.models.index import Index, PyPI
|
||||
|
||||
|
||||
__all__ = ["Index", "PyPI"]
|
|
@ -9,11 +9,13 @@ from pip._vendor import pkg_resources
|
|||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
from pip._vendor.pkg_resources import RequirementParseError
|
||||
|
||||
from pip.exceptions import InstallationError
|
||||
from pip.req import InstallRequirement
|
||||
from pip.req.req_file import COMMENT_RE
|
||||
from pip.utils import dist_is_editable, get_installed_distributions
|
||||
from pip.utils.deprecation import RemovedInPip11Warning
|
||||
from pip._internal.exceptions import InstallationError
|
||||
from pip._internal.req import InstallRequirement
|
||||
from pip._internal.req.req_file import COMMENT_RE
|
||||
from pip._internal.utils.deprecation import RemovedInPip11Warning
|
||||
from pip._internal.utils.misc import (
|
||||
dist_is_editable, get_installed_distributions
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -150,7 +152,7 @@ class FrozenRequirement(object):
|
|||
def from_dist(cls, dist, dependency_links):
|
||||
location = os.path.normcase(os.path.abspath(dist.location))
|
||||
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):
|
||||
editable = True
|
||||
try:
|
|
@ -6,18 +6,18 @@ import os
|
|||
|
||||
from pip._vendor import pkg_resources, requests
|
||||
|
||||
from pip.compat import expanduser
|
||||
from pip.download import (
|
||||
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
|
||||
)
|
||||
from pip.exceptions import (
|
||||
from pip._internal.exceptions import (
|
||||
DirectoryUrlHashUnsupported, HashUnpinned, InstallationError,
|
||||
PreviousBuildDirError, VcsHashUnsupported
|
||||
)
|
||||
from pip.utils import display_path, dist_in_usersite, normalize_path
|
||||
from pip.utils.hashes import MissingHashes
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.vcs import vcs
|
||||
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
|
||||
from pip._internal.vcs import vcs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -164,8 +164,7 @@ class RequirementPreparer(object):
|
|||
# satisfied_by is only evaluated by calling _check_skip_installed,
|
||||
# so it must be None here.
|
||||
assert req.satisfied_by is None
|
||||
if not resolver.ignore_installed:
|
||||
skip_reason = resolver._check_skip_installed(req)
|
||||
skip_reason = resolver._check_skip_installed(req)
|
||||
|
||||
if req.satisfied_by:
|
||||
return self._prepare_installed_requirement(
|
||||
|
@ -302,12 +301,7 @@ class RequirementPreparer(object):
|
|||
resolver.ignore_installed
|
||||
)
|
||||
if should_modify:
|
||||
# don't uninstall conflict if user install and
|
||||
# conflict is not user install
|
||||
if not (resolver.use_user_site and
|
||||
not dist_in_usersite(req.satisfied_by)):
|
||||
req.conflicts_with = req.satisfied_by
|
||||
req.satisfied_by = None
|
||||
resolver._set_req_to_reinstall(req)
|
||||
else:
|
||||
logger.info(
|
||||
'Requirement already satisfied (use '
|
|
@ -10,7 +10,7 @@ import sysconfig
|
|||
import warnings
|
||||
from collections import OrderedDict
|
||||
|
||||
import pip.utils.glibc
|
||||
import pip._internal.utils.glibc
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -154,7 +154,7 @@ def is_manylinux1_compatible():
|
|||
pass
|
||||
|
||||
# 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):
|
||||
|
@ -314,7 +314,4 @@ def get_supported(versions=None, noarch=False, platform=None,
|
|||
return supported
|
||||
|
||||
|
||||
supported_tags = get_supported()
|
||||
supported_tags_noarch = get_supported(noarch=True)
|
||||
|
||||
implementation_tag = get_impl_tag()
|
|
@ -1,10 +1,10 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from .req_install import InstallRequirement
|
||||
from .req_set import RequirementSet, Requirements
|
||||
from .req_set import RequirementSet
|
||||
from .req_file import parse_requirements
|
||||
|
||||
__all__ = [
|
||||
"RequirementSet", "Requirements", "InstallRequirement",
|
||||
"RequirementSet", "InstallRequirement",
|
||||
"parse_requirements",
|
||||
]
|
|
@ -13,10 +13,10 @@ import sys
|
|||
from pip._vendor.six.moves import filterfalse
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
from pip import cmdoptions
|
||||
from pip.download import get_file_content
|
||||
from pip.exceptions import RequirementsFileParseError
|
||||
from pip.req.req_install import InstallRequirement
|
||||
from pip._internal import cmdoptions
|
||||
from pip._internal.download import get_file_content
|
||||
from pip._internal.exceptions import RequirementsFileParseError
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
|
||||
__all__ = ['parse_requirements']
|
||||
|
||||
|
@ -117,7 +117,7 @@ def process_line(line, filename, line_number, finder=None, comes_from=None,
|
|||
:param constraint: If True, parsing a constraints file.
|
||||
:param options: OptionParser options that we may update
|
||||
"""
|
||||
parser = build_parser()
|
||||
parser = build_parser(line)
|
||||
defaults = parser.get_default_values()
|
||||
defaults.index_url = None
|
||||
if finder:
|
||||
|
@ -228,7 +228,7 @@ def break_args_options(line):
|
|||
return ' '.join(args), ' '.join(options)
|
||||
|
||||
|
||||
def build_parser():
|
||||
def build_parser(line):
|
||||
"""
|
||||
Return a parser for parsing requirement lines
|
||||
"""
|
||||
|
@ -242,6 +242,8 @@ def build_parser():
|
|||
# By default optparse sys.exits on parsing errors. We want to wrap
|
||||
# that in our own exception.
|
||||
def parser_exit(self, msg):
|
||||
# add offending line
|
||||
msg = 'Invalid requirement: %s\n%s' % (line, msg)
|
||||
raise RequirementsFileParseError(msg)
|
||||
parser.exit = parser_exit
|
||||
|
|
@ -21,25 +21,29 @@ from pip._vendor.packaging.version import parse as parse_version
|
|||
from pip._vendor.packaging.version import Version
|
||||
from pip._vendor.pkg_resources import RequirementParseError, parse_requirements
|
||||
|
||||
import pip.wheel
|
||||
from pip.compat import native_str
|
||||
from pip.download import is_archive_file, is_url, path_to_url, url_to_path
|
||||
from pip.exceptions import InstallationError, UninstallationError
|
||||
from pip.locations import PIP_DELETE_MARKER_FILENAME, running_under_virtualenv
|
||||
from pip.req.req_uninstall import UninstallPathSet
|
||||
from pip.utils import (
|
||||
from pip._internal import wheel
|
||||
from pip._internal.compat import native_str
|
||||
from pip._internal.download import (
|
||||
is_archive_file, is_url, path_to_url, url_to_path
|
||||
)
|
||||
from pip._internal.exceptions import InstallationError, UninstallationError
|
||||
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,
|
||||
display_path, dist_in_site_packages, dist_in_usersite, ensure_dir,
|
||||
get_installed_version, is_installable_dir, read_text_file, rmtree
|
||||
)
|
||||
from pip.utils.deprecation import RemovedInPip11Warning
|
||||
from pip.utils.hashes import Hashes
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.setuptools_build import SETUPTOOLS_SHIM
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.utils.ui import open_spinner
|
||||
from pip.vcs import vcs
|
||||
from pip.wheel import Wheel, move_wheel_files
|
||||
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
|
||||
from pip._internal.vcs import vcs
|
||||
from pip._internal.wheel import Wheel, move_wheel_files
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -78,7 +82,7 @@ class InstallRequirement(object):
|
|||
if link is not None:
|
||||
self.link = self.original_link = link
|
||||
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)
|
||||
|
||||
if extras:
|
||||
|
@ -123,7 +127,7 @@ class InstallRequirement(object):
|
|||
@classmethod
|
||||
def from_editable(cls, editable_req, comes_from=None, isolated=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)
|
||||
if url.startswith('file:'):
|
||||
|
@ -169,7 +173,7 @@ class InstallRequirement(object):
|
|||
"""Creates an InstallRequirement from a name, which might be a
|
||||
requirement, directory containing 'setup.py', filename, or URL.
|
||||
"""
|
||||
from pip.index import Link
|
||||
from pip._internal.index import Link
|
||||
|
||||
if is_url(name):
|
||||
marker_sep = '; '
|
||||
|
@ -720,15 +724,16 @@ class InstallRequirement(object):
|
|||
else:
|
||||
return True
|
||||
|
||||
def install(self, install_options, global_options=[], root=None,
|
||||
def install(self, install_options, global_options=None, root=None,
|
||||
prefix=None):
|
||||
global_options = global_options if global_options is not None else []
|
||||
if self.editable:
|
||||
self.install_editable(
|
||||
install_options, global_options, prefix=prefix)
|
||||
return
|
||||
if self.is_wheel:
|
||||
version = pip.wheel.wheel_version(self.source_dir)
|
||||
pip.wheel.check_compatibility(version, self.name)
|
||||
version = wheel.wheel_version(self.source_dir)
|
||||
wheel.check_compatibility(version, self.name)
|
||||
|
||||
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
|
||||
self.install_succeeded = True
|
||||
|
@ -1003,7 +1008,7 @@ def parse_editable(editable_req):
|
|||
.[some_extra]
|
||||
"""
|
||||
|
||||
from pip.index import Link
|
||||
from pip._internal.index import Link
|
||||
|
||||
url = editable_req
|
||||
|
|
@ -1,43 +1,15 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
from collections import OrderedDict, defaultdict
|
||||
|
||||
from pip.exceptions import InstallationError
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.wheel import Wheel
|
||||
from pip._internal.exceptions import InstallationError
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.wheel import Wheel
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Requirements(object):
|
||||
|
||||
def __init__(self):
|
||||
self._keys = []
|
||||
self._dict = {}
|
||||
|
||||
def keys(self):
|
||||
return self._keys
|
||||
|
||||
def values(self):
|
||||
return [self._dict[key] for key in self._keys]
|
||||
|
||||
def __contains__(self, item):
|
||||
return item in self._keys
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if key not in self._keys:
|
||||
self._keys.append(key)
|
||||
self._dict[key] = value
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self._dict[key]
|
||||
|
||||
def __repr__(self):
|
||||
values = ['%s: %s' % (repr(k), repr(self[k])) for k in self.keys()]
|
||||
return 'Requirements({%s})' % ', '.join(values)
|
||||
|
||||
|
||||
class RequirementSet(object):
|
||||
|
||||
def __init__(self,
|
||||
|
@ -49,8 +21,7 @@ class RequirementSet(object):
|
|||
InstallRequirement.
|
||||
"""
|
||||
|
||||
self.requirements = Requirements()
|
||||
|
||||
self.requirements = OrderedDict()
|
||||
self.require_hashes = require_hashes
|
||||
|
||||
# Mapping of alias: real_name
|
|
@ -9,15 +9,15 @@ import sysconfig
|
|||
|
||||
from pip._vendor import pkg_resources
|
||||
|
||||
from pip.compat import WINDOWS, cache_from_source, uses_pycache
|
||||
from pip.exceptions import UninstallationError
|
||||
from pip.locations import bin_py, bin_user
|
||||
from pip.utils import (
|
||||
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.logging import indent_log
|
||||
from pip._internal.utils.misc import (
|
||||
FakeFile, ask, dist_in_usersite, dist_is_local, egg_link_path, is_local,
|
||||
normalize_path, renames
|
||||
)
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -13,14 +13,14 @@ for sub-dependencies
|
|||
import logging
|
||||
from itertools import chain
|
||||
|
||||
from pip.exceptions import (
|
||||
BestVersionAlreadyInstalled,
|
||||
DistributionNotFound, HashError, HashErrors, UnsupportedPythonVersion
|
||||
from pip._internal.exceptions import (
|
||||
BestVersionAlreadyInstalled, DistributionNotFound, HashError, HashErrors,
|
||||
UnsupportedPythonVersion
|
||||
)
|
||||
from pip.req.req_install import InstallRequirement
|
||||
from pip.utils import dist_in_usersite, ensure_dir
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.packaging import check_dist_requires_python
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.utils.misc import dist_in_usersite, ensure_dir
|
||||
from pip._internal.utils.packaging import check_dist_requires_python
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -75,7 +75,7 @@ class Resolver(object):
|
|||
# hash-checking mode, which requires hashes from all.
|
||||
root_reqs = (
|
||||
requirement_set.unnamed_requirements +
|
||||
requirement_set.requirements.values()
|
||||
list(requirement_set.requirements.values())
|
||||
)
|
||||
self.require_hashes = (
|
||||
requirement_set.require_hashes or
|
||||
|
@ -114,6 +114,16 @@ class Resolver(object):
|
|||
assert self.upgrade_strategy == "only-if-needed"
|
||||
return req.is_direct
|
||||
|
||||
def _set_req_to_reinstall(self, req):
|
||||
"""
|
||||
Set a requirement to be installed.
|
||||
"""
|
||||
# Don't uninstall the conflict if doing a user install and the
|
||||
# conflict is not a user install.
|
||||
if not self.use_user_site or dist_in_usersite(req.satisfied_by):
|
||||
req.conflicts_with = req.satisfied_by
|
||||
req.satisfied_by = None
|
||||
|
||||
# XXX: Stop passing requirement_set for options
|
||||
def _check_skip_installed(self, req_to_install):
|
||||
"""Check if req_to_install should be skipped.
|
||||
|
@ -133,55 +143,36 @@ class Resolver(object):
|
|||
|
||||
:return: A text reason for why it was skipped, or None.
|
||||
"""
|
||||
# Check whether to upgrade/reinstall this req or not.
|
||||
req_to_install.check_if_exists()
|
||||
if req_to_install.satisfied_by:
|
||||
upgrade_allowed = self._is_upgrade_allowed(req_to_install)
|
||||
|
||||
# Is the best version is installed.
|
||||
best_installed = False
|
||||
|
||||
if upgrade_allowed:
|
||||
# For link based requirements we have to pull the
|
||||
# tree down and inspect to assess the version #, so
|
||||
# its handled way down.
|
||||
should_check_possibility_for_upgrade = not (
|
||||
self.force_reinstall or req_to_install.link
|
||||
)
|
||||
if should_check_possibility_for_upgrade:
|
||||
try:
|
||||
self.finder.find_requirement(
|
||||
req_to_install, upgrade_allowed)
|
||||
except BestVersionAlreadyInstalled:
|
||||
best_installed = True
|
||||
except DistributionNotFound:
|
||||
# No distribution found, so we squash the
|
||||
# error - it will be raised later when we
|
||||
# re-try later to do the install.
|
||||
# Why don't we just raise here?
|
||||
pass
|
||||
|
||||
if not best_installed:
|
||||
# don't uninstall conflict if user install and
|
||||
# conflict is not user install
|
||||
if not (self.use_user_site and not
|
||||
dist_in_usersite(req_to_install.satisfied_by)):
|
||||
req_to_install.conflicts_with = \
|
||||
req_to_install.satisfied_by
|
||||
req_to_install.satisfied_by = None
|
||||
|
||||
# Figure out a nice message to say why we're skipping this.
|
||||
if best_installed:
|
||||
skip_reason = 'already up-to-date'
|
||||
elif self.upgrade_strategy == "only-if-needed":
|
||||
skip_reason = 'not upgraded as not directly required'
|
||||
else:
|
||||
skip_reason = 'already satisfied'
|
||||
|
||||
return skip_reason
|
||||
else:
|
||||
if self.ignore_installed:
|
||||
return None
|
||||
|
||||
req_to_install.check_if_exists()
|
||||
if not req_to_install.satisfied_by:
|
||||
return None
|
||||
|
||||
if not self._is_upgrade_allowed(req_to_install):
|
||||
if self.upgrade_strategy == "only-if-needed":
|
||||
return 'not upgraded as not directly required'
|
||||
return 'already satisfied'
|
||||
|
||||
# Check for the possibility of an upgrade. For link-based
|
||||
# requirements we have to pull the tree down and inspect to assess
|
||||
# the version #, so it's handled way down.
|
||||
if not (self.force_reinstall or req_to_install.link):
|
||||
try:
|
||||
self.finder.find_requirement(req_to_install, upgrade=True)
|
||||
except BestVersionAlreadyInstalled:
|
||||
# Then the best version is installed.
|
||||
return 'already up-to-date'
|
||||
except DistributionNotFound:
|
||||
# No distribution found, so we squash the error. It will
|
||||
# be raised later when we re-try later to do the install.
|
||||
# Why don't we just raise here?
|
||||
pass
|
||||
|
||||
self._set_req_to_reinstall(req_to_install)
|
||||
return None
|
||||
|
||||
def _resolve_one(self, requirement_set, req_to_install):
|
||||
"""Prepare a single requirements file.
|
||||
|
|
@ -9,7 +9,7 @@ import sys
|
|||
|
||||
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):
|
|
@ -43,7 +43,7 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
|
|||
if issubclass(category, PipDeprecationWarning):
|
||||
# We use a specially named logger which will handle all of the
|
||||
# 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
|
||||
# the logging module handle the interpolation. This is because we
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import os.path
|
||||
|
||||
from pip.compat import get_path_uid
|
||||
from pip._internal.compat import get_path_uid
|
||||
|
||||
|
||||
def check_path_owner(path):
|
|
@ -4,8 +4,10 @@ import hashlib
|
|||
|
||||
from pip._vendor.six import iteritems, iterkeys, itervalues
|
||||
|
||||
from pip.exceptions import HashMismatch, HashMissing, InstallationError
|
||||
from pip.utils import read_chunks
|
||||
from pip._internal.exceptions import (
|
||||
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 art changes; it won't hurt backward compatibility.
|
|
@ -5,8 +5,8 @@ import logging
|
|||
import logging.handlers
|
||||
import os
|
||||
|
||||
from pip.compat import WINDOWS
|
||||
from pip.utils import ensure_dir
|
||||
from pip._internal.compat import WINDOWS
|
||||
from pip._internal.utils.misc import ensure_dir
|
||||
|
||||
try:
|
||||
import threading
|
|
@ -1,6 +1,5 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from collections import deque
|
||||
import contextlib
|
||||
import errno
|
||||
import io
|
||||
|
@ -8,28 +7,30 @@ import locale
|
|||
# we have a submodule named 'logging' which would shadow this if we used the
|
||||
# regular name:
|
||||
import logging as std_logging
|
||||
import re
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import shutil
|
||||
import stat
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
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.six.moves import input
|
||||
from pip._vendor.six import PY2
|
||||
# NOTE: retrying is not annotated in typeshed as on 2017-07-17, which is
|
||||
# why we ignore the type on this import
|
||||
# why we ignore the type on this import.
|
||||
from pip._vendor.retrying import retry # type: ignore
|
||||
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:
|
||||
from io import BytesIO as StringIO
|
||||
|
@ -608,7 +609,7 @@ def unpack_file(filename, location, content_type, link):
|
|||
elif (content_type and content_type.startswith('text/html') and
|
||||
is_svn_page(file_contents(filename))):
|
||||
# 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)
|
||||
else:
|
||||
# FIXME: handle?
|
|
@ -9,11 +9,11 @@ import sys
|
|||
from pip._vendor import lockfile
|
||||
from pip._vendor.packaging import version as packaging_version
|
||||
|
||||
from pip.compat import WINDOWS
|
||||
from pip.index import PackageFinder
|
||||
from pip.locations import USER_CACHE_DIR, running_under_virtualenv
|
||||
from pip.utils import ensure_dir, get_installed_version
|
||||
from pip.utils.filesystem import check_path_owner
|
||||
from pip._internal.compat import WINDOWS
|
||||
from pip._internal.index import PackageFinder
|
||||
from pip._internal.locations import USER_CACHE_DIR, running_under_virtualenv
|
||||
from pip._internal.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"
|
||||
|
|
@ -7,7 +7,7 @@ from email.parser import FeedParser
|
|||
from pip._vendor import pkg_resources
|
||||
from pip._vendor.packaging import specifiers, version
|
||||
|
||||
from pip import exceptions
|
||||
from pip._internal import exceptions
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import os.path
|
||||
import tempfile
|
||||
|
||||
from pip.utils import rmtree
|
||||
from pip._internal.utils.misc import rmtree
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -15,10 +15,10 @@ from pip._vendor.progress.bar import (
|
|||
from pip._vendor.progress.helpers import HIDE_CURSOR, SHOW_CURSOR, WritelnMixin
|
||||
from pip._vendor.progress.spinner import Spinner
|
||||
|
||||
from pip.compat import WINDOWS
|
||||
from pip.utils import format_size
|
||||
from pip.utils.logging import get_indentation
|
||||
from pip.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.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
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Any
|
|
@ -9,14 +9,15 @@ import sys
|
|||
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
from pip.exceptions import BadCommand
|
||||
from pip.utils import (display_path, backup_dir, call_subprocess,
|
||||
rmtree, ask_path_exists)
|
||||
from pip.utils.typing import MYPY_CHECK_RUNNING
|
||||
from pip._internal.exceptions import BadCommand
|
||||
from pip._internal.utils.misc import (
|
||||
display_path, backup_dir, call_subprocess, rmtree, ask_path_exists,
|
||||
)
|
||||
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
|
||||
|
||||
if MYPY_CHECK_RUNNING:
|
||||
from typing import Dict, Tuple
|
||||
from pip.basecommand import Command
|
||||
from pip._internal.basecommand import Command
|
||||
|
||||
__all__ = ['vcs', 'get_src_requirement']
|
||||
|
|
@ -5,10 +5,10 @@ import os
|
|||
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
from pip.download import path_to_url
|
||||
from pip.utils import display_path, rmtree
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.vcs import VersionControl, vcs
|
||||
from pip._internal.download import path_to_url
|
||||
from pip._internal.utils.misc import display_path, rmtree
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.vcs import VersionControl, vcs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -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 request as urllib_request
|
||||
|
||||
from pip.compat import samefile
|
||||
from pip.exceptions import BadCommand
|
||||
from pip.utils import display_path
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.vcs import VersionControl, vcs
|
||||
from pip._internal.compat import samefile
|
||||
from pip._internal.exceptions import BadCommand
|
||||
from pip._internal.utils.misc import display_path
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.vcs import VersionControl, vcs
|
||||
|
||||
urlsplit = urllib_parse.urlsplit
|
||||
urlunsplit = urllib_parse.urlunsplit
|
|
@ -5,10 +5,10 @@ import os
|
|||
|
||||
from pip._vendor.six.moves import configparser
|
||||
|
||||
from pip.download import path_to_url
|
||||
from pip.utils import display_path
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.vcs import VersionControl, vcs
|
||||
from pip._internal.download import path_to_url
|
||||
from pip._internal.utils.misc import display_path
|
||||
from pip._internal.utils.temp_dir import TempDirectory
|
||||
from pip._internal.vcs import VersionControl, vcs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -6,10 +6,10 @@ import re
|
|||
|
||||
from pip._vendor.six.moves.urllib import parse as urllib_parse
|
||||
|
||||
from pip.index import Link
|
||||
from pip.utils import display_path, rmtree
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.vcs import VersionControl, vcs
|
||||
from pip._internal.index import Link
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.utils.misc import display_path, rmtree
|
||||
from pip._internal.vcs import VersionControl, vcs
|
||||
|
||||
_svn_xml_url_re = re.compile('url="([^"]+)"')
|
||||
_svn_rev_re = re.compile(r'committed-rev="(\d+)"')
|
||||
|
@ -163,7 +163,7 @@ class Subversion(VersionControl):
|
|||
return self._get_svn_url_rev(location)[0]
|
||||
|
||||
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')
|
||||
if os.path.exists(entries_path):
|
|
@ -23,18 +23,21 @@ from pip._vendor.distlib.scripts import ScriptMaker
|
|||
from pip._vendor.packaging.utils import canonicalize_name
|
||||
from pip._vendor.six import StringIO
|
||||
|
||||
import pip.index
|
||||
from pip import pep425tags
|
||||
from pip.download import path_to_url, unpack_url
|
||||
from pip.exceptions import (
|
||||
from pip._internal import pep425tags
|
||||
from pip._internal.download import path_to_url, unpack_url
|
||||
from pip._internal.exceptions import (
|
||||
InstallationError, InvalidWheelFilename, UnsupportedWheel
|
||||
)
|
||||
from pip.locations import PIP_DELETE_MARKER_FILENAME, distutils_scheme
|
||||
from pip.utils import call_subprocess, captured_stdout, ensure_dir, read_chunks
|
||||
from pip.utils.logging import indent_log
|
||||
from pip.utils.setuptools_build import SETUPTOOLS_SHIM
|
||||
from pip.utils.temp_dir import TempDirectory
|
||||
from pip.utils.ui import open_spinner
|
||||
from pip._internal.locations import (
|
||||
PIP_DELETE_MARKER_FILENAME, distutils_scheme
|
||||
)
|
||||
from pip._internal.utils.logging import indent_log
|
||||
from pip._internal.utils.misc import (
|
||||
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'
|
||||
|
||||
|
@ -482,7 +485,7 @@ class Wheel(object):
|
|||
|
||||
wheel_file_re = re.compile(
|
||||
r"""^(?P<namever>(?P<name>.+?)-(?P<ver>.*?))
|
||||
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
|
||||
((-(?P<build>\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
|
||||
\.whl|\.dist-info)$""",
|
||||
re.VERBOSE
|
||||
)
|
||||
|
@ -501,6 +504,7 @@ class Wheel(object):
|
|||
# we'll assume "_" means "-" due to wheel naming scheme
|
||||
# (https://github.com/pypa/pip/issues/1150)
|
||||
self.version = wheel_info.group('ver').replace('_', '-')
|
||||
self.build_tag = wheel_info.group('build')
|
||||
self.pyversions = wheel_info.group('pyver').split('.')
|
||||
self.abis = wheel_info.group('abi').split('.')
|
||||
self.plats = wheel_info.group('plat').split('.')
|
||||
|
@ -519,14 +523,14 @@ class Wheel(object):
|
|||
None is the wheel is not supported.
|
||||
"""
|
||||
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]
|
||||
return min(indexes) if indexes else None
|
||||
|
||||
def supported(self, tags=None):
|
||||
"""Is this wheel supported on this system?"""
|
||||
if tags is None: # for mock
|
||||
tags = pep425tags.supported_tags
|
||||
tags = pep425tags.get_supported()
|
||||
return bool(set(tags).intersection(self.file_tags))
|
||||
|
||||
|
||||
|
@ -617,8 +621,8 @@ class WheelBuilder(object):
|
|||
|
||||
def _install_build_reqs(self, reqs, prefix):
|
||||
# Local import to avoid circular import (wheel <-> req_install)
|
||||
from pip.req.req_install import InstallRequirement
|
||||
from pip.index import FormatControl
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
from pip._internal.index import FormatControl
|
||||
# Ignore the --no-binary option when installing the build system, so
|
||||
# we don't recurse trying to build a self-hosting build system.
|
||||
finder = copy.copy(self.finder)
|
||||
|
@ -726,6 +730,8 @@ class WheelBuilder(object):
|
|||
newly built wheel, in preparation for installation.
|
||||
:return: True if all the wheels built correctly.
|
||||
"""
|
||||
from pip._internal import index
|
||||
|
||||
building_is_possible = self._wheel_dir or (
|
||||
autobuilding and self.wheel_cache.cache_dir
|
||||
)
|
||||
|
@ -751,11 +757,11 @@ class WheelBuilder(object):
|
|||
if autobuilding:
|
||||
link = req.link
|
||||
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
|
||||
# because we'll have no way to lookup the result sanely
|
||||
continue
|
||||
if "binary" not in pip.index.fmt_ctl_formats(
|
||||
if "binary" not in index.fmt_ctl_formats(
|
||||
self.finder.format_control,
|
||||
canonicalize_name(req.name)):
|
||||
logger.info(
|
||||
|
@ -812,8 +818,7 @@ class WheelBuilder(object):
|
|||
self.preparer.build_dir
|
||||
)
|
||||
# Update the link for this.
|
||||
req.link = pip.index.Link(
|
||||
path_to_url(wheel_file))
|
||||
req.link = index.Link(path_to_url(wheel_file))
|
||||
assert req.link.is_wheel
|
||||
# extract the wheel into the dir
|
||||
unpack_url(
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue