Add support for extra variants of relative urls for simple html pypi API #174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why:
I have a private python packages repository powered by Sonatype Nexus Repository software.
This repo unfortunatelly only supports simple HTTP API, and, additionally, list of packages from Nexus looks like that:
GET https://self-hosted-nexus-repo.example/repository/pypi/simple/example-python-package/
And because urls starts with
.
, micropip thinks that they are not relative urls and does not append index url to it.So, for example, if we are installing example-python-package==0.1 from web page called
my-web-page.example
, web brouser receives GET request to../../packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>
from micropip and interpretes it ashttps://my-web-page.example/repository/pypi/packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>
instead ofhttps://self-hosted-nexus-repo.example/packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>
.What: better check for relative vs absolute url when dealing with simple HTTP API.
P.S. I can't figure out how to make tests that require spawn_web_server to work properly. But my part should not affect those, so I hope it is fine.