@@ -19,18 +19,22 @@ index 4e6174c..75f9b49 100644
19
19
# NOTE
20
20
# We used to store the cache dir under ~/.pip-tools, which is not the
21
21
diff --git a/pipenv/patched/piptools/repositories/pypi.py b/pipenv/patched/piptools/repositories/pypi.py
22
- index 1c4b943..c922be1 100644
22
+ index 1c4b943..91902dc 100644
23
23
--- a/pipenv/patched/piptools/repositories/pypi.py
24
24
+++ b/pipenv/patched/piptools/repositories/pypi.py
25
- @@ -4,6 +4,7 @@ from __future__ import (absolute_import, division, print_function,
26
-
25
+ @@ -1,9 +1,10 @@
26
+ # coding: utf-8
27
+ from __future__ import (absolute_import, division, print_function,
28
+ unicode_literals)
29
+ -
30
+ + import copy
27
31
import hashlib
28
32
import os
29
33
+ import sys
30
34
from contextlib import contextmanager
31
35
from shutil import rmtree
32
36
33
- @@ -15,13 +16,24 @@ from .._compat import (
37
+ @@ -15,13 +16,22 @@ from .._compat import (
34
38
Wheel,
35
39
FAVORITE_HASH,
36
40
TemporaryDirectory,
@@ -40,25 +44,23 @@ index 1c4b943..c922be1 100644
40
44
+ SafeFileCache,
41
45
)
42
46
43
- + from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
44
- + from pip._vendor.packaging.version import Version, InvalidVersion, parse as parse_version
45
- + from pip._vendor.packaging.specifiers import SpecifierSet, InvalidSpecifier, Specifier
46
- + from pip._vendor.packaging.markers import Marker, Op, Value, Variable
47
- + from pip._vendor.pyparsing import ParseException
47
+ - from ..cache import CACHE_DIR
48
+ + from pip._vendor.packaging.requirements import Requirement
49
+ + from pip._vendor.packaging.specifiers import SpecifierSet, Specifier
50
+ + from pip._vendor.packaging.markers import Op, Value, Variable
48
51
+ from pip._internal.exceptions import InstallationError
52
+ + from pip._internal.vcs import VcsSupport
49
53
+
50
- from ..cache import CACHE_DIR
51
54
+ from pipenv.environments import PIPENV_CACHE_DIR
52
55
from ..exceptions import NoCandidateFound
53
- - from ..utils import (fs_str, is_pinned_requirement, lookup_table,
56
+ from ..utils import (fs_str, is_pinned_requirement, lookup_table,
54
57
- make_install_requirement)
55
- + from ..utils import (fs_str, is_pinned_requirement, lookup_table, as_tuple, key_from_req,
56
- + make_install_requirement, format_requirement, dedup, clean_requires_python)
58
+ + make_install_requirement, clean_requires_python)
57
59
+
58
60
from .base import BaseRepository
59
61
60
62
61
- @@ -37,6 +49,40 @@ except ImportError:
63
+ @@ -37,6 +47,45 @@ except ImportError:
62
64
from pip.wheel import WheelCache
63
65
64
66
@@ -77,15 +79,20 @@ index 1c4b943..c922be1 100644
77
79
+ def get_hash(self, location):
78
80
+ # if there is no location hash (i.e., md5 / sha256 / etc) we on't want to store it
79
81
+ hash_value = None
80
- + can_hash = location.hash
82
+ + vcs = VcsSupport()
83
+ + orig_scheme = location.scheme
84
+ + new_location = copy.deepcopy(location)
85
+ + if orig_scheme in vcs.all_schemes:
86
+ + new_location.url = new_location.url.split("+", 1)[-1]
87
+ + can_hash = new_location.hash
81
88
+ if can_hash:
82
89
+ # hash url WITH fragment
83
- + hash_value = self.get(location .url)
90
+ + hash_value = self.get(new_location .url)
84
91
+ if not hash_value:
85
- + hash_value = self._get_file_hash(location )
92
+ + hash_value = self._get_file_hash(new_location )
86
93
+ hash_value = hash_value.encode('utf8')
87
94
+ if can_hash:
88
- + self.set(location .url, hash_value)
95
+ + self.set(new_location .url, hash_value)
89
96
+ return hash_value.decode('utf8')
90
97
+
91
98
+ def _get_file_hash(self, location):
@@ -99,7 +106,7 @@ index 1c4b943..c922be1 100644
99
106
class PyPIRepository(BaseRepository):
100
107
DEFAULT_INDEX_URL = PyPI.simple_url
101
108
102
- @@ -46,10 +92 ,11 @@ class PyPIRepository(BaseRepository):
109
+ @@ -46,10 +95 ,11 @@ class PyPIRepository(BaseRepository):
103
110
config), but any other PyPI mirror can be used if index_urls is
104
111
changed/configured on the Finder.
105
112
"""
@@ -113,7 +120,7 @@ index 1c4b943..c922be1 100644
113
120
114
121
index_urls = [pip_options.index_url] + pip_options.extra_index_urls
115
122
if pip_options.no_index:
116
- @@ -74,11 +121 ,15 @@ class PyPIRepository(BaseRepository):
123
+ @@ -74,11 +124 ,15 @@ class PyPIRepository(BaseRepository):
117
124
# of all secondary dependencies for the given requirement, so we
118
125
# only have to go to disk once for each requirement
119
126
self._dependencies_cache = {}
@@ -131,7 +138,7 @@ index 1c4b943..c922be1 100644
131
138
132
139
def freshen_build_caches(self):
133
140
"""
134
- @@ -114,10 +165 ,14 @@ class PyPIRepository(BaseRepository):
141
+ @@ -114,10 +168 ,14 @@ class PyPIRepository(BaseRepository):
135
142
if ireq.editable:
136
143
return ireq # return itself as the best match
137
144
@@ -148,7 +155,7 @@ index 1c4b943..c922be1 100644
148
155
149
156
# Reuses pip's internal candidate sort key to sort
150
157
matching_candidates = [candidates_by_version[ver] for ver in matching_versions]
151
- @@ -126,11 +181 ,71 @@ class PyPIRepository(BaseRepository):
158
+ @@ -126,11 +184 ,71 @@ class PyPIRepository(BaseRepository):
152
159
best_candidate = max(matching_candidates, key=self.finder._candidate_sort_key)
153
160
154
161
# Turn the candidate into a pinned InstallRequirement
@@ -223,7 +230,7 @@ index 1c4b943..c922be1 100644
223
230
"""
224
231
Given a pinned or an editable InstallRequirement, returns a set of
225
232
dependencies (also InstallRequirements, but not necessarily pinned).
226
- @@ -155,20 +270,40 @@ class PyPIRepository(BaseRepository):
233
+ @@ -155,20 +273,47 @@ class PyPIRepository(BaseRepository):
227
234
os.makedirs(download_dir)
228
235
if not os.path.isdir(self._wheel_download_dir):
229
236
os.makedirs(self._wheel_download_dir)
@@ -235,6 +242,13 @@ index 1c4b943..c922be1 100644
235
242
+ dist = None
236
243
+ if ireq.editable:
237
244
+ try:
245
+ + from pipenv.utils import chdir
246
+ + with chdir(ireq.setup_py_dir):
247
+ + from setuptools.dist import distutils
248
+ + distutils.core.run_setup(ireq.setup_py)
249
+ + except (ImportError, InstallationError, TypeError, AttributeError):
250
+ + pass
251
+ + try:
238
252
+ dist = ireq.get_dist()
239
253
+ except InstallationError:
240
254
+ ireq.run_egg_info()
@@ -268,7 +282,7 @@ index 1c4b943..c922be1 100644
268
282
)
269
283
except TypeError:
270
284
# Pip >= 10 (new resolver!)
271
- @@ -188,17 +323 ,97 @@ class PyPIRepository(BaseRepository):
285
+ @@ -188,17 +333 ,97 @@ class PyPIRepository(BaseRepository):
272
286
finder=self.finder,
273
287
session=self.session,
274
288
upgrade_strategy="to-satisfy-only",
@@ -369,7 +383,18 @@ index 1c4b943..c922be1 100644
369
383
return set(self._dependencies_cache[ireq])
370
384
371
385
def get_hashes(self, ireq):
372
- @@ -217,24 +432,22 @@ class PyPIRepository(BaseRepository):
386
+ @@ -210,6 +435,10 @@ class PyPIRepository(BaseRepository):
387
+ if ireq.editable:
388
+ return set()
389
+
390
+ + vcs = VcsSupport()
391
+ + if ireq.link and ireq.link.scheme in vcs.all_schemes and 'ssh' in ireq.link.scheme:
392
+ + return set()
393
+ +
394
+ if not is_pinned_requirement(ireq):
395
+ raise TypeError(
396
+ "Expected pinned requirement, got {}".format(ireq))
397
+ @@ -217,24 +446,22 @@ class PyPIRepository(BaseRepository):
373
398
# We need to get all of the candidates that match our current version
374
399
# pin, these will represent all of the files that could possibly
375
400
# satisfy this constraint.
0 commit comments