mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-21 15:20:59 +00:00
4cf36f82a7
* Apply patch for install_search_all_sources = True * patch the patch * Add news fragment * add back test of install_search_all_sources
104 lines
3.6 KiB
Diff
104 lines
3.6 KiB
Diff
diff --git a/pipenv/patched/pip/_internal/index/collector.py b/pipenv/patched/pip/_internal/index/collector.py
|
|
index b3e293ea3..f27a88725 100644
|
|
--- a/pipenv/patched/pip/_internal/index/collector.py
|
|
+++ b/pipenv/patched/pip/_internal/index/collector.py
|
|
@@ -412,9 +412,11 @@ class LinkCollector:
|
|
self,
|
|
session: PipSession,
|
|
search_scope: SearchScope,
|
|
+ index_lookup: Optional[Dict[str, List[str]]] = None,
|
|
) -> None:
|
|
self.search_scope = search_scope
|
|
self.session = session
|
|
+ self.index_lookup = index_lookup if index_lookup else {}
|
|
|
|
@classmethod
|
|
def create(
|
|
@@ -422,6 +424,7 @@ class LinkCollector:
|
|
session: PipSession,
|
|
options: Values,
|
|
suppress_no_index: bool = False,
|
|
+ index_lookup: Optional[Dict[str, List[str]]] = None,
|
|
) -> "LinkCollector":
|
|
"""
|
|
:param session: The Session to use to make requests.
|
|
@@ -443,10 +446,12 @@ class LinkCollector:
|
|
find_links=find_links,
|
|
index_urls=index_urls,
|
|
no_index=options.no_index,
|
|
+ index_lookup=index_lookup,
|
|
)
|
|
link_collector = LinkCollector(
|
|
session=session,
|
|
search_scope=search_scope,
|
|
+ index_lookup=index_lookup,
|
|
)
|
|
return link_collector
|
|
|
|
diff --git a/pipenv/patched/pip/_internal/models/search_scope.py b/pipenv/patched/pip/_internal/models/search_scope.py
|
|
index fe61e8116..98a2cc97f 100644
|
|
--- a/pipenv/patched/pip/_internal/models/search_scope.py
|
|
+++ b/pipenv/patched/pip/_internal/models/search_scope.py
|
|
@@ -3,7 +3,7 @@ import logging
|
|
import os
|
|
import posixpath
|
|
import urllib.parse
|
|
-from typing import List
|
|
+from typing import Dict, List, Optional
|
|
|
|
from pip._vendor.packaging.utils import canonicalize_name
|
|
|
|
@@ -20,7 +20,7 @@ class SearchScope:
|
|
Encapsulates the locations that pip is configured to search.
|
|
"""
|
|
|
|
- __slots__ = ["find_links", "index_urls", "no_index"]
|
|
+ __slots__ = ["find_links", "index_urls", "no_index", "index_lookup", "index_restricted"]
|
|
|
|
@classmethod
|
|
def create(
|
|
@@ -28,6 +28,8 @@ class SearchScope:
|
|
find_links: List[str],
|
|
index_urls: List[str],
|
|
no_index: bool,
|
|
+ index_lookup: Optional[Dict[str, List[str]]] = None,
|
|
+ index_restricted: bool = False,
|
|
) -> "SearchScope":
|
|
"""
|
|
Create a SearchScope object after normalizing the `find_links`.
|
|
@@ -62,6 +64,8 @@ class SearchScope:
|
|
find_links=built_find_links,
|
|
index_urls=index_urls,
|
|
no_index=no_index,
|
|
+ index_lookup=index_lookup,
|
|
+ index_restricted=index_restricted,
|
|
)
|
|
|
|
def __init__(
|
|
@@ -69,10 +73,14 @@ class SearchScope:
|
|
find_links: List[str],
|
|
index_urls: List[str],
|
|
no_index: bool,
|
|
+ index_lookup: Optional[Dict[str, List[str]]] = None,
|
|
+ index_restricted: bool = False,
|
|
) -> None:
|
|
self.find_links = find_links
|
|
self.index_urls = index_urls
|
|
self.no_index = no_index
|
|
+ self.index_lookup = index_lookup if index_lookup else {}
|
|
+ self.index_restricted = index_restricted
|
|
|
|
def get_formatted_locations(self) -> str:
|
|
lines = []
|
|
@@ -129,4 +137,9 @@ class SearchScope:
|
|
loc = loc + "/"
|
|
return loc
|
|
|
|
- return [mkurl_pypi_url(url) for url in self.index_urls]
|
|
+ index_urls = self.index_urls
|
|
+ if project_name in self.index_lookup:
|
|
+ index_urls = [self.index_lookup[project_name]]
|
|
+ elif self.index_restricted and self.index_urls:
|
|
+ index_urls = [self.index_urls[0]]
|
|
+ return [mkurl_pypi_url(url) for url in index_urls]
|