Update patches

Signed-off-by: Dan Ryan <dan@danryan.co>
This commit is contained in:
Dan Ryan
2018-05-17 14:27:07 -04:00
parent 0dbc5c6871
commit 9986c75d68
3 changed files with 26 additions and 98 deletions
@@ -174,95 +174,3 @@ index 4254fbd..a7efaa0 100644
DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
from io import UnsupportedOperation
diff --git a/pipenv/patched/piptools/cache.py b/pipenv/patched/piptools/cache.py
index 7595b96..5a44953 100644
--- a/pipenv/patched/piptools/cache.py
+++ b/pipenv/patched/piptools/cache.py
@@ -6,7 +6,7 @@ import json
import os
import sys
-from pip._vendor.packaging.requirements import Requirement
+from pip9._vendor.packaging.requirements import Requirement
from .exceptions import PipToolsError
from .locations import CACHE_DIR
diff --git a/pipenv/patched/piptools/repositories/base.py b/pipenv/patched/piptools/repositories/base.py
index 57e85fd..69835c0 100644
--- a/pipenv/patched/piptools/repositories/base.py
+++ b/pipenv/patched/piptools/repositories/base.py
@@ -44,5 +44,5 @@ class BaseRepository(object):
@contextmanager
def allow_all_wheels(self):
"""
- Monkey patches pip.Wheel to allow wheels from all platforms and Python versions.
+ Monkey patches pip9.Wheel to allow wheels from all platforms and Python versions.
"""
diff --git a/pipenv/patched/piptools/repositories/local.py b/pipenv/patched/piptools/repositories/local.py
index 8f6f028..3c6182b 100644
--- a/pipenv/patched/piptools/repositories/local.py
+++ b/pipenv/patched/piptools/repositories/local.py
@@ -6,7 +6,7 @@ from contextlib import contextmanager
from piptools.utils import as_tuple, key_from_req, make_install_requirement
from .base import BaseRepository
-from pip.utils.hashes import FAVORITE_HASH
+from pip9.utils.hashes import FAVORITE_HASH
def ireq_satisfied_by_existing_pin(ireq, existing_pin):
diff --git a/pipenv/patched/piptools/repositories/pypi.py b/pipenv/patched/piptools/repositories/pypi.py
index e1f63d2..03833a4 100644
--- a/pipenv/patched/piptools/repositories/pypi.py
+++ b/pipenv/patched/piptools/repositories/pypi.py
@@ -317,7 +317,7 @@ class PyPIRepository(BaseRepository):
@contextmanager
def allow_all_wheels(self):
"""
- Monkey patches pip.Wheel to allow wheels from all platforms and Python versions.
+ Monkey patches pip9.Wheel to allow wheels from all platforms and Python versions.
This also saves the candidate cache and set a new one, or else the results from the
previous non-patched calls will interfere.
diff --git a/pipenv/patched/piptools/resolver.py b/pipenv/patched/piptools/resolver.py
index 862be14..64b1199 100644
--- a/pipenv/patched/piptools/resolver.py
+++ b/pipenv/patched/piptools/resolver.py
@@ -8,7 +8,7 @@ from itertools import chain, count
import os
from first import first
-from pip.req import InstallRequirement
+from pip9.req import InstallRequirement
from . import click
from .cache import DependencyCache
diff --git a/pipenv/patched/piptools/scripts/compile.py b/pipenv/patched/piptools/scripts/compile.py
index 0e83bfc..8194fcf 100644
--- a/pipenv/patched/piptools/scripts/compile.py
+++ b/pipenv/patched/piptools/scripts/compile.py
@@ -247,9 +247,9 @@ def cli(verbose, dry_run, pre, rebuild, find_links, index_url, extra_index_url,
def get_pip_command():
- # Use pip's parser for pip.conf management and defaults.
+ # Use pip's parser for pip9.conf management and defaults.
# General options (find_links, index_url, extra_index_url, trusted_host,
- # and pre) are defered to pip.
+ # and pre) are defered to pip9.
pip_command = PipCommand()
index_opts = pip9.cmdoptions.make_option_group(
pip9.cmdoptions.index_group,
diff --git a/pipenv/patched/safety/cli.py b/pipenv/patched/safety/cli.py
index 37ae3ac..fc543ef 100644
--- a/pipenv/patched/safety/cli.py
+++ b/pipenv/patched/safety/cli.py
@@ -15,7 +15,7 @@ try:
from pip import get_installed_distributions
except ImportError:
# pip 10
- from pip._internal.utils.misc import get_installed_distributions
+ from pip9._internal.utils.misc import get_installed_distributions
@click.group()
+15 -6
View File
@@ -53,7 +53,7 @@ index 1c4b943..39a285b 100644
+ def __init__(self, *args, **kwargs):
+ session = kwargs.pop('session')
+ self.session = session
+ kwargs.setdefault('directory', os.path.join(PIPENV_CACHE_DIR, hash-cache'))
+ kwargs.setdefault('directory', os.path.join(PIPENV_CACHE_DIR, 'hash-cache'))
+ super(HashCache, self).__init__(*args, **kwargs)
+
+ def get_hash(self, location):
@@ -121,7 +121,7 @@ index 1c4b943..39a285b 100644
+ def get_json_dependencies(self, ireq):
+
+ if not (is_pinned_requirement(ireq)):
+ raise TypeError('Expected pinned InstallRequirement, got {}.format(ireq))
+ raise TypeError('Expected pinned InstallRequirement, got {}'.format(ireq))
+
+ def gen(ireq):
+ if self.DEFAULT_INDEX_URL in self.finder.index_urls:
@@ -264,7 +264,7 @@ index 1c4b943..39a285b 100644
def allow_all_wheels(self):
"""
diff --git a/pipenv/patched/piptools/resolver.py b/pipenv/patched/piptools/resolver.py
index 8c4e981..862be14 100644
index 05ec8fd..6380e8f 100644
--- a/pipenv/patched/piptools/resolver.py
+++ b/pipenv/patched/piptools/resolver.py
@@ -14,7 +14,7 @@ from . import click
@@ -327,7 +327,7 @@ index 8c4e981..862be14 100644
elif not is_pinned_requirement(ireq):
raise TypeError('Expected pinned or editable requirement, got {}'.format(ireq))
@@ -283,14 +295,26 @@ class Resolver(object):
@@ -283,14 +295,25 @@ class Resolver(object):
if ireq not in self.dependency_cache:
log.debug(' {} not in cache, need to check index'.format(format_requirement(ireq)), fg='yellow')
dependencies = self.repository.get_dependencies(ireq)
@@ -339,7 +339,7 @@ index 8c4e981..862be14 100644
dependency_strings = self.dependency_cache[ireq]
log.debug(' {:25} requires {}'.format(format_requirement(ireq),
', '.join(sorted(dependency_strings, key=lambda s: s.lower())) or '-'))
+ from notpip._vendor.packaging.markers import InvalidMarker
+ from pip9._vendor.packaging.markers import InvalidMarker
for dependency_string in dependency_strings:
- yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
+ try:
@@ -352,7 +352,6 @@ index 8c4e981..862be14 100644
+ yield InstallRequirement.from_line(_dependency_string, constraint=ireq.constraint)
+ except InvalidMarker:
+ yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
+
def reverse_dependencies(self, ireqs):
non_editable = [ireq for ireq in ireqs if not ireq.editable]
@@ -455,3 +454,13 @@ index 7e8cdf3..2b5c12a 100644
-PyPI = do_import('models.index', 'PyPI')
+PyPI = do_import('models.index', 'PyPI', vendored_name='notpip')
+SafeFileCache = do_import('download', 'SafeFileCache', vendored_name='notpip')
diff --git a/pipenv/patched/piptools/_compat/__init__.py b/piptools/_compat/__init__.py
index 674674a..4259028 100644
--- a/pipenv/patched/piptools/_compat/__init__.py
+++ b/pipenv/patched/piptools/_compat/__init__.py
@@ -27,4 +27,5 @@ from .pip_compat import (
cmdoptions,
get_installed_distributions,
PyPI,
+ SafeFileCache,
)
+11
View File
@@ -351,3 +351,14 @@ index c9ebbf1..728f5cc 100644
path_to_url(wheel_file))
assert req.link.is_wheel
# extract the wheel into the dir
diff --git a/pipenv/vendor/pip9/__main__.py b/pipenv/vendor/pip9/__main__.py
index 9849a65c..da041f92 100644
--- a/pipenv/vendor/pip9/__main__.py
+++ b/pipenv/vendor/pip9/__main__.py
@@ -16,4 +16,4 @@ if __package__ == '':
import pip9 # noqa
if __name__ == '__main__':
- sys.exit(pip.main())
+ sys.exit(pip9.main())