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
unzip with gz too #4883
unzip with gz too #4883
Conversation
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.
Docs omit? don't be lazy please: https://docs.conan.io/en/latest/reference/tools.html#tools-unzip
Yes, sorry, I did a (very) quick look at the docs, and thought the extensions were not detailed. Docs added. |
import gzip | ||
with gzip.open(filename, 'rb') as f: | ||
file_content = f.read() | ||
target_name = filename[:-3] if destination == "." else destination |
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.
Here the destination is expected to be a file (not a directory like in the other cases), the docstring for this function doesn't match. If given a directory this function will fail in the load
with a IsADirectoryError
. I'm not sure if we want to handle it better.
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.
Updated docstring.
I have tried passing a folder as argument, and it failed (py2, Win), with IOError: [Errno 13] Permission denied: 'mytemp'
. I think in either case the error should be clear enough, catching and re-raising a ConanException is a bit overkill for this case.
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.
No, don't need to reraise, it was just about the docstring (it is a documented tool). Don't forget to update it: https://docs.conan.io/en/latest/reference/tools.html#tools-unzip 😉
Changelog: Feature:
tools.get()
andtools.unzip()
now handle also.gz
compressed filesDocs: conan-io/docs#1230
Close #4876
@tags: slow