From 0f8e6a57719359f62513fdab05e65174421d1e8f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 23 Sep 2024 07:42:04 -0400 Subject: [PATCH] Correct index safety patch --- .../pip/_internal/models/search_scope.py | 9 +++---- .../patches/patched/pip_index_safety.patch | 26 ++++++++++++------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pipenv/patched/pip/_internal/models/search_scope.py b/pipenv/patched/pip/_internal/models/search_scope.py index 4d5161edd6..73115e064f 100644 --- a/pipenv/patched/pip/_internal/models/search_scope.py +++ b/pipenv/patched/pip/_internal/models/search_scope.py @@ -15,19 +15,16 @@ logger = logging.getLogger(__name__) -@dataclass(frozen=True) +@dataclass(frozen=False) class SearchScope: """ Encapsulates the locations that pip is configured to search. """ - - __slots__ = ["find_links", "index_urls", "no_index", "index_lookup", "index_restricted"] - find_links: List[str] index_urls: List[str] no_index: bool - index_lookup: Optional[Dict[str, str]] - index_restricted: Optional[bool] + index_lookup: Optional[Dict[str, str]] = None + index_restricted: Optional[bool] = None @classmethod def create( diff --git a/tasks/vendoring/patches/patched/pip_index_safety.patch b/tasks/vendoring/patches/patched/pip_index_safety.patch index a07f6776fe..3d7f55db1d 100644 --- a/tasks/vendoring/patches/patched/pip_index_safety.patch +++ b/tasks/vendoring/patches/patched/pip_index_safety.patch @@ -36,7 +36,7 @@ index 5f8fdee3d..b7c40c190 100644 return link_collector diff --git a/pipenv/patched/pip/_internal/models/search_scope.py b/pipenv/patched/pip/_internal/models/search_scope.py -index ee7bc8622..1ea2bdca4 100644 +index ee7bc8622..5e24ae67e 100644 --- a/pipenv/patched/pip/_internal/models/search_scope.py +++ b/pipenv/patched/pip/_internal/models/search_scope.py @@ -4,7 +4,7 @@ import os @@ -48,22 +48,28 @@ index ee7bc8622..1ea2bdca4 100644 from pip._vendor.packaging.utils import canonicalize_name -@@ -21,11 +21,13 @@ class SearchScope: +@@ -15,17 +15,16 @@ from pip._internal.utils.misc import normalize_path, redact_auth_from_url + logger = logging.getLogger(__name__) + + +-@dataclass(frozen=True) ++@dataclass(frozen=False) + 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"] - +- find_links: List[str] index_urls: List[str] no_index: bool -+ index_lookup: Optional[Dict[str, str]] -+ index_restricted: Optional[bool] ++ index_lookup: Optional[Dict[str, str]] = None ++ index_restricted: Optional[bool] = None @classmethod def create( -@@ -33,6 +35,8 @@ class SearchScope: +@@ -33,6 +32,8 @@ class SearchScope: find_links: List[str], index_urls: List[str], no_index: bool, @@ -72,7 +78,7 @@ index ee7bc8622..1ea2bdca4 100644 ) -> "SearchScope": """ Create a SearchScope object after normalizing the `find_links`. -@@ -67,6 +71,8 @@ class SearchScope: +@@ -67,6 +68,8 @@ class SearchScope: find_links=built_find_links, index_urls=index_urls, no_index=no_index, @@ -81,7 +87,7 @@ index ee7bc8622..1ea2bdca4 100644 ) def get_formatted_locations(self) -> str: -@@ -124,4 +130,9 @@ class SearchScope: +@@ -124,4 +127,9 @@ class SearchScope: loc = loc + "/" return loc