|
| 1 | +--- a/pipenv/patched/pip/_internal/index/package_finder.py |
| 2 | ++++ b/pipenv/patched/pip/_internal/index/package_finder.py |
| 3 | +@@ -135,6 +135,7 @@ class LinkEvaluator: |
| 4 | + target_python: TargetPython, |
| 5 | + allow_yanked: bool, |
| 6 | + ignore_requires_python: Optional[bool] = None, |
| 7 | ++ ignore_compatibility: Optional[bool] = None, |
| 8 | + ) -> None: |
| 9 | + """ |
| 10 | + :param project_name: The user supplied package name. |
| 11 | +@@ -152,6 +153,8 @@ class LinkEvaluator: |
| 12 | + :param ignore_requires_python: Whether to ignore incompatible |
| 13 | + PEP 503 "data-requires-python" values in HTML links. Defaults |
| 14 | + to False. |
| 15 | ++ :param ignore_compatibility: Whether to ignore |
| 16 | ++ compatibility of python versions and allow all versions of packages. |
| 17 | + """ |
| 18 | + if ignore_requires_python is None: |
| 19 | + ignore_requires_python = False |
| 20 | +@@ -161,7 +164,7 @@ class LinkEvaluator: |
| 21 | + self._ignore_requires_python = ignore_requires_python |
| 22 | + self._formats = formats |
| 23 | + self._target_python = target_python |
| 24 | +- |
| 25 | ++ self._ignore_compatibility = ignore_compatibility |
| 26 | + self.project_name = project_name |
| 27 | + |
| 28 | + def evaluate_link(self, link: Link) -> Tuple[LinkType, str]: |
| 29 | +@@ -191,10 +194,10 @@ class LinkEvaluator: |
| 30 | + LinkType.format_unsupported, |
| 31 | + f"unsupported archive format: {ext}", |
| 32 | + ) |
| 33 | +- if "binary" not in self._formats and ext == WHEEL_EXTENSION: |
| 34 | ++ if "binary" not in self._formats and ext == WHEEL_EXTENSION and not self._ignore_compatibility: |
| 35 | + reason = f"No binaries permitted for {self.project_name}" |
| 36 | + return (LinkType.format_unsupported, reason) |
| 37 | +- if "macosx10" in link.path and ext == ".zip": |
| 38 | ++ if "macosx10" in link.path and ext == ".zip" and not self._ignore_compatibility: |
| 39 | + return (LinkType.format_unsupported, "macosx10 one") |
| 40 | + if ext == WHEEL_EXTENSION: |
| 41 | + try: |
| 42 | +@@ -209,7 +212,7 @@ class LinkEvaluator: |
| 43 | + return (LinkType.different_project, reason) |
| 44 | + |
| 45 | + supported_tags = self._target_python.get_unsorted_tags() |
| 46 | +- if not wheel.supported(supported_tags): |
| 47 | ++ if not wheel.supported(supported_tags) and not self._ignore_compatibility: |
| 48 | + # Include the wheel's tags in the reason string to |
| 49 | + # simplify troubleshooting compatibility issues. |
| 50 | + file_tags = ", ".join(wheel.get_formatted_file_tags()) |
| 51 | +@@ -250,7 +253,7 @@ class LinkEvaluator: |
| 52 | + version_info=self._target_python.py_version_info, |
| 53 | + ignore_requires_python=self._ignore_requires_python, |
| 54 | + ) |
| 55 | +- if not supports_python: |
| 56 | ++ if not supports_python and not self._ignore_compatibility: |
| 57 | + reason = f"{version} Requires-Python {link.requires_python}" |
| 58 | + return (LinkType.requires_python_mismatch, reason) |
| 59 | + |
| 60 | +@@ -473,7 +476,11 @@ class PackageFinder: |
| 61 | + |
| 62 | + return sorted(filtered_applicable_candidates, key=self._sort_key) |
| 63 | + |
| 64 | +- def _sort_key(self, candidate: InstallationCandidate) -> CandidateSortingKey: |
| 65 | ++ def _sort_key( |
| 66 | ++ self, |
| 67 | ++ candidate: InstallationCandidate, |
| 68 | ++ ignore_compatibility: bool = True, |
| 69 | ++ ) -> CandidateSortingKey: |
| 70 | + """ |
| 71 | + Function to pass as the `key` argument to a call to sorted() to sort |
| 72 | + InstallationCandidates by preference. |
| 73 | +@@ -518,10 +525,12 @@ class PackageFinder: |
| 74 | + ) |
| 75 | + ) |
| 76 | + except ValueError: |
| 77 | +- raise UnsupportedWheel( |
| 78 | +- f"{wheel.filename} is not a supported wheel for this platform. It " |
| 79 | +- "can't be sorted." |
| 80 | +- ) |
| 81 | ++ if not ignore_compatibility: |
| 82 | ++ raise UnsupportedWheel( |
| 83 | ++ f"{wheel.filename} is not a supported wheel for this platform. It " |
| 84 | ++ "can't be sorted." |
| 85 | ++ ) |
| 86 | ++ pri = -support_num |
| 87 | + if self._prefer_binary: |
| 88 | + binary_preference = 1 |
| 89 | + build_tag = wheel.build_tag |
| 90 | +@@ -584,6 +593,7 @@ class PackageFinder: |
| 91 | + format_control: Optional[FormatControl] = None, |
| 92 | + candidate_prefs: Optional[CandidatePreferences] = None, |
| 93 | + ignore_requires_python: Optional[bool] = None, |
| 94 | ++ ignore_compatibility: Optional[bool] = False, |
| 95 | + ) -> None: |
| 96 | + """ |
| 97 | + This constructor is primarily meant to be used by the create() class |
| 98 | +@@ -605,7 +615,7 @@ class PackageFinder: |
| 99 | + self._ignore_requires_python = ignore_requires_python |
| 100 | + self._link_collector = link_collector |
| 101 | + self._target_python = target_python |
| 102 | +- |
| 103 | ++ self._ignore_compatibility = ignore_compatibility |
| 104 | + self.format_control = format_control |
| 105 | + |
| 106 | + # These are boring links that have already been logged somehow. |
| 107 | +@@ -730,6 +740,7 @@ class PackageFinder: |
| 108 | + target_python=self._target_python, |
| 109 | + allow_yanked=self._allow_yanked, |
| 110 | + ignore_requires_python=self._ignore_requires_python, |
| 111 | ++ ignore_compatibility=self._ignore_compatibility, |
| 112 | + ) |
| 113 | + |
| 114 | + def _sort_links(self, links: Iterable[Link]) -> List[Link]: |
0 commit comments