Skip to content

Commit

Permalink
Add implied assertion in WheelInfo
Browse files Browse the repository at this point in the history
Some simple indexes (anaconda), only list the full-pathname of download
URL (assuming same domain, which make sens).

WheelInfo.download does not work on this case at it tries to make the
requests on the current page domain.

Thus we implicitely assume that URL start with http (well https:// would
be better, but when you prototype local index could be http.)

The error can be weird if we let it propagate (bad ziplife as you try to
decode often a 404 html page as ZIP).

This thus just add an assert at construction time to catch the error
early.

It should in the end be pushed earler in the code (likely at parsing
time), where we are likely to know the index URL and be able to resolve
URLs at that time.
  • Loading branch information
Carreau committed Oct 21, 2024
1 parent 4044983 commit 8819999
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions micropip/wheelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class WheelInfo:
_dist_info: Path | None = None

def __post_init__(self):
assert self.url.startswith("http")
self._project_name = safe_name(self.name)

@classmethod
Expand Down

0 comments on commit 8819999

Please sign in to comment.