-
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: Broken cache on Windows #4531
fix: Broken cache on Windows #4531
Conversation
59e63d5
to
7203328
Compare
I wonder if we can create a testcase that will fail that this fixes? |
@Ivoz do you know where to put full end-to-end tests (running poetry commands)? |
I have yet to test the tests without the fix on Windows, but this PR is ready. |
I confirmed that this fixes #4541. |
@finswimmer @sdispater I'd like a review of this PR because this is a major issue for all Windows users |
Win 10 x64, Python 3.9.6 @ master 82459bd
Paste contents of the two tests/ files from this PR @ 25adda8
Only Paste contents of
So @serverwentdown it appears to me naively that the executor tests at least do not fail prior to the functional patch, not sure if this was intended or not |
@Ivoz Oh you're right! Thanks for catching this lack of test coverage. I'll fix it after I sleep, but my main suspect is that fixture_dir returns a relative path hence the bug does not get triggered. |
No, I'm misreading code. Will attempt to figure it out again tomorrow. |
0f322be
to
5b551d6
Compare
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.
Overall looks good. Some minor suggestions.
I have made changes a while back, need another review. @abn? @sdispater? Anyone who sees this PR can leave a review on this PR too. (Also, check out the backport to #4549) |
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.
This looks a lot better than the current code -- we're making a lot better use of duck typing while eliminating a rather silly corner case. There's still some isinstance()
, but I think you've got it down to the bare minimum
I'm ready to merge this once it passes lint and is rebased onto the current master
(the FreeBSD tests were fixed there) -- and please make sure to make the same post-review changes to your backport PR.
Closes python-poetry#4479 The previous implementation would fail to install packages on Windows because it creates a `Path` starting with a slash. Such a `Path` is invalid on Windows. Instead, use the utility function url_to_path.
In the future, pip_editable_install really should be removed
21e46f1
to
316f6a6
Compare
Merged! Thank you for your work on this -- and sorry that poetry has been broken so long! |
Awesome, thanks for getting this finally merged! 🥳 |
Great! Thanks for fixing this. |
Closes python-poetry#4479 The previous implementation would fail to install packages on Windows because it creates a `Path` starting with a slash. Such a `Path` is invalid on Windows. Instead, use `Link` and `url_to_path`.
Closes python-poetry#4479 The previous implementation would fail to install packages on Windows because it creates a `Path` starting with a slash. Such a `Path` is invalid on Windows. Instead, use `Link` and `url_to_path`.
`poetry install` raised: `AttributeError: 'Link' object has no attribute 'is_absolute'` during build on platform.sh. It appears that it's possible for poetry-core to update even if poetry is locked. Our issue wasa caused by a regression introduced in 1.0.4. Updated poetry following the advice in the linked github issue and updated pip to fix an issue selecting the correct wheel for cryptography 36.0.0 on platform.sh. Locked Poetry to 1.1.12 and pip to 21.3.1 for docker and platform.sh Related issues: - [Link object being passed instead of Path to poetry.core.packages.file_dependency.FileDependency in poetry-core 1.0.5](python-poetry/poetry#4541) - [fix: Broken cache on Windows #4531](python-poetry/poetry#4531)
`poetry install` raised: `AttributeError: 'Link' object has no attribute 'is_absolute'` during build on platform.sh. It appears that it's possible for poetry-core to update even if poetry is locked. Our issue wasa caused by a regression introduced in 1.0.4. Updated poetry following the advice in the linked github issue and updated pip to fix an issue selecting the correct wheel for cryptography `36.0.0` on platform.sh. Locked Poetry to `1.1.12` and pip to `21.3.1` for docker and platform.sh Related issues: - [Link object being passed instead of Path to poetry.core.packages.file_dependency.FileDependency in poetry-core 1.0.5](python-poetry/poetry#4541) - [fix: Broken cache on Windows #4531](python-poetry/poetry#4531)
`poetry install` raised: `AttributeError: 'Link' object has no attribute 'is_absolute'` during build on platform.sh. It appears that it's possible for poetry-core to update even if poetry is locked. Our issue wasa caused by a regression introduced in 1.0.4. Updated poetry following the advice in the linked github issue and updated pip to fix an issue selecting the correct wheel for cryptography `36.0.0` on platform.sh. Locked Poetry to `1.1.12` and pip to `21.3.1` for docker and platform.sh Related issues: - [Link object being passed instead of Path to poetry.core.packages.file_dependency.FileDependency in poetry-core 1.0.5](h - [fix: Broken cache on Windows #4531](python-poetry/poetry#4531)
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. |
(Backport to 1.1: #4549)
The previous implementation would fail to install packages on Windows because it creates a
Path
starting with a slash. Such aPath
is invalid on Windows. Instead, use the utility function url_to_path.Additionally (not a bug in 1.1, migrated from separate PR at #4532), Links and Paths were passed in to pip_install as a string. This makes it hard for pip_install to parse out the extension of the file to install. By accepting only Links or Paths, pip_install can parse out the extension using the Link. This also resolves a bug when Executor._download_link returns a Link, which can't be parsed by Path(str(link)) on Windows.
This was overlooked when running on Linux because file:/path/to/cache is somehow a valid pip install path in Python on Linux, but not a valid path on Windows. With this PR, pip install is always called with a proper Path (/path/to/cache) and never a Path-parsed Link (file:/path/to/cache)
Pull Request Check List
Resolves: #4479 #4535