-
-
Notifications
You must be signed in to change notification settings - Fork 372
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
Introduce the File
tool and tweak stub binary implementation
#1871
Conversation
src/briefcase/exceptions.py
Outdated
super().__init__(f"Unable to unpack support package {filename!r}") | ||
super().__init__(f"Unable to unpack support package '{filename}'.") |
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.
If you just call repr()
here and filename
is a Path
, it looks like this:
Unable to unpack support package PosixPath("/asdf")
so, this strategy gets what we actually want.
Unable to unpack support package '/asdf'
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.
Torn between whether we should use the explicit '
, or {str(filename)!r}
- that should ensure that any inline quotes are correctly escaped (I think...)
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.
You mean like these differences?
>>> file_path=Path("/pa't'h/to/file")
>>>
>>> print(f"File is {file_path}")
File is /pa't'h/to/file
>>>
>>> print(f"File is {str(file_path)!r}")
File is "/pa't'h/to/file"
>>>
>>> print(f"File is '{file_path}'")
File is '/pa't'h/to/file'
Manually calling str()
does seem to handle that edge case best.
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.
That's what I had in mind, yes.
ive nerdsniped myself in to implementing a |
File
tool and tweak stub binary implementation
- Encapsulates complex file operations such as archive unpacking - Incorporates the (now removed) Download tool's functionality
The updates for the |
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.
A large PR, but largely straightforward, with some nice cleanups along the way. One minor suggestion about some possibly overenthusiastic modularity; weak preference would be to remove it, but if you feel particularly strongly to the contrary, I'm not going to fight you too hard over it.
src/briefcase/integrations/file.py
Outdated
}, | ||
) | ||
|
||
def _unpack_archive_kwargs(self, archive_path: str | os.PathLike) -> dict[str, str]: |
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.
Possibly a little over-enthusiastic refactoring here; function calls aren't free, and in practice, this method can't be overwritten by a subclass. Given it's wrapping a single if clause that won't be needed in a couple of Python releases, I'm not sure the extra method is worth it.
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.
That makes sense. I also tweaked it a bit so (in theory, anyway) pyupgrade should have an easier time trimming it down later on.
A new problem from this is a corrupted Wasn't there work being done to ensure the bundle was deleted if the |
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.
👍 LGTM.
Changes
File
toolNotes
PR Checklist: