Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions micropip/_compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@

to_js = compatibility_layer.to_js

HttpStatusError = compatibility_layer.HttpStatusError


__all__ = [
"LOCKFILE_INFO",
"LOCKFILE_PACKAGES",
Expand All @@ -47,5 +44,4 @@
"loadPackage",
"get_dynlibs",
"to_js",
"HttpStatusError",
]
8 changes: 0 additions & 8 deletions micropip/_compat/compatibility_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ class CompatibilityLayer(ABC):
All of the following methods / properties must be implemented for use both inside and outside of pyodide.
"""

class HttpStatusError(ABC, Exception):
Comment thread
agriyakhetarpal marked this conversation as resolved.
status_code: int
message: str

@abstractmethod
def __init__(self, status_code: int, message: str):
pass

class loadedPackages(ABC):
@staticmethod
@abstractmethod
Expand Down
14 changes: 7 additions & 7 deletions micropip/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any
from urllib.parse import urljoin, urlparse, urlunparse

from ._compat import HttpStatusError, fetch_string_and_headers
from ._compat import fetch_string_and_headers
from ._utils import is_package_compatible, parse_version
from ._vendored.mousebender.simple import from_project_details_html
from ._vendored.packaging.src.packaging.utils import InvalidWheelFilename
Expand Down Expand Up @@ -313,14 +313,14 @@ async def query_package(
logger.debug("Url has no placeholder, appending package name : %r", url)
try:
metadata, headers = await fetch_string_and_headers(url, _fetch_kwargs)
except HttpStatusError as e:
if e.status_code == 404:
logger.debug("NotFound (404) for %r, trying next index.", url)
continue
except Exception as e:
logger.debug(
"Error fetching %r (%s), trying next index.", url, e.status_code
"Error fetching metadata for the package %r from (%r): %r, trying next index.",
name,
url,
e,
)
raise
continue

content_type = headers.get("content-type", "").lower()
try:
Expand Down
30 changes: 0 additions & 30 deletions tests/test_compat.py

This file was deleted.