-
Notifications
You must be signed in to change notification settings - Fork 239
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
Handle case where output_dir does not already exist on macos & windows #1851
Merged
henryiii
merged 15 commits into
pypa:main
from
MusicalNinjaDad:MusicalNinjaDad/issue1850
Jun 7, 2024
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
94fced5
replace `with suppress(FileNotFoundError)` by `.unlink(missing_ok=Tru…
MusicalNinjaDad 5f9e4dd
also use `.unlink(missing_ok=True)` in pyodide and windows for consis…
MusicalNinjaDad cbf5afd
remove contextlib imports which are no longer required
MusicalNinjaDad 872009b
Apply suggestions from code review
henryiii dfe8737
explicity resolve and create output location
MusicalNinjaDad 9202c83
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6dd397e
use explicit str for move
MusicalNinjaDad 16b96ca
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cb804c9
Merge branch 'main' into MusicalNinjaDad/issue1850
MusicalNinjaDad df77e97
update comments based on review feedback
MusicalNinjaDad e04bc49
Apply suggestions from code review
henryiii db4abe2
Break out functionality to move files to util.py
MusicalNinjaDad 8a98f74
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2f18df5
raise instance of IsADirectoryError with meaningful message
MusicalNinjaDad 03aeff3
Don't need a comment and a exception message
MusicalNinjaDad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
IMHO, we should add a
move
function inutil.py
which takes care of unlinking, creating the parent directory and actually moving the wheel. It could be reused on all 3 platforms (workaround might be needed for local builds on macOS with pyodide for exemple).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.
Hi mayeut,
That's a good idea.
Also a good catch: I missed updating pyodide as I wasn't building for it on my test project.
I'd be happy to put the change together later today.
What's the issue that you would see with local macos-pyodide builds?
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.
I'd imagine the util function has a signature along the lines of:
movewheel(wheel: Path) -> Path
, directly accessesbuild_options
as this is global and returnsoutput_wheel
, leavingbuilt_wheels.append
at the calling site for clarity.Does that make sense?
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.
The function signature should be something like
move(src: Path, dst: Path) -> None
So similar to shutil.move but taking care of unlinking dst and creating the parent directory of dst.
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.
How about this? (See latest push). I'm happy with the shape of the function and it follows shutil.move closely (which also returns the destination path).
I'm slightly less happy with the import inside the function but felt that logging the move was valuable enough to pay that price.
I've tested against macos & windows. I couldn't test pyodide as the test project I'm using is rust-based and I haven't got pyodide/emscripten working for that yet ...
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.
What sort of issues are you hitting? It should Just Work™ in most cases, so there's a chance it's hitting a Pyodide or cibuildwheel bug.
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.
We can probably split utils up later to avoid the circular import, it's pretty big. Not something to worry about for this PR.
Why is the warning at every usage? Would it make sense to warn inside the function if it doesn't copy where it's supposed to?
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.
rust seemed to be targetting the wrong target on the one time I tried "just switching it on" as part of testing this PR. Looking at the code and the implementation PR on cibuildwheel side, I get the impression that I "just" need to add a few config entries into pyproject.toml, find the best way to build in pipeline, check whether ADO artefact repos can accept the wheels, and set up some kind of test environment to play with the result...
It looks interesting enough that I'm likely to try playing with it in my sandbox project soon
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.
I'd consider it to be in the responsibility of the main script to double check that a called util did what was expected, that also covers the risk of later changes to utils etc.
Adding the warning to
util.move_file
feels like a no-op to me ... the only line that would effectively be checked is whethershutil.move
did what was expected (?)