-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: installing wheel from trailing slash url #4619
fix: installing wheel from trailing slash url #4619
Conversation
For discoverability, this is a possible solution for an error that looks like
|
I'm running into this issue as well even when trying to get poetry to update itself:
When I manually apply the changes from this pull request, it works around the problem. |
Debug now outputs whole url instead of just the wheel's filename. This is more detail that does not get in the way because it only occurs at high verbosity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! That looks really good and helps clean this up a lot.
Last step: let's add a regression test that checks that we successfully handle paths with a trailing slash.
Thanks! Sounds good. I'm not very familiar with the |
Indeed it would! You should find some mock examples there to get you started. |
Thanks for the guidance. Unfortunately, none of the tests actually deal with the Making a change in the mocked
still has all the tests pass -- but I am not sure this codepath is actually being tested. |
@pechersky Any chance you can rebase this onto current |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
Resolves: n/a
Provide a step-by-step description of the suggested enhancement in as many details as possible.
Currently, the
poetry add ...
code looks for wheels or sdists at a pypi at an index url. In some cases, the url the server sends back might be of the formhttps://my.pypi.server/path/to/my_package.whl/
. Unfortunately, the code currently does anrsplit
and keeps only the terminal result of that split. For such a url, this is the empty string. This causes the filename to where the wheel is to be written to is empty-string. That meanspoetry add
tries to write a file to/tmp/tmpdircreated
, which is a directory, which fails.The expected behavior is proper installation/addition of a package. This is done via a slightly more complicated parsing of the url. If the terminal item after rsplitting is empty, then use the penultimate item instead.
Unfortunately, I cannot provide an explicit example of the url that causes the issue, because it is in a private pypi.
There are no existing test cases for this particular code path. A single test might not make sense, it only could be an integration test.
The current documentation says nothing about the urls the server sends back.