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 flat directory #8208
Unzip flat directory #8208
Conversation
what do you think on returning the flat directory, so it could be chained like:
|
But this feature removes the directory... why do you want to return it? |
@@ -72,17 +71,6 @@ | |||
""" | |||
|
|||
|
|||
def zipdir(path, zipfilename): |
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.
Moved to test utils
conans/client/tools/files.py
Outdated
@@ -55,7 +55,8 @@ def human_size(size_bytes): | |||
return "%s%s" % (formatted_size, suffix) | |||
|
|||
|
|||
def unzip(filename, destination=".", keep_permissions=False, pattern=None, output=None): | |||
def unzip(filename, destination=".", keep_permissions=False, pattern=None, output=None, | |||
flat_folder=False): |
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.
flat_folder name could be improved?, I would read it as getting rid of all levels of subfolders, not just dropping the first level one
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.
sure, suggestions? crop_first_folder
, flat_first
....?
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.
ignore_root
?
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.
skip_root
?
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.
flat_root
?
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.
Co-authored-by: James <james@conan.io>
conans/client/tools/files.py
Outdated
@@ -55,7 +55,8 @@ def human_size(size_bytes): | |||
return "%s%s" % (formatted_size, suffix) | |||
|
|||
|
|||
def unzip(filename, destination=".", keep_permissions=False, pattern=None, output=None): | |||
def unzip(filename, destination=".", keep_permissions=False, pattern=None, output=None, | |||
flat_folder=False): |
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.
Co-authored-by: James <james@conan.io>
Changelog: Feature: The
tools.get
,tools.unzip
andtools.untargz
now accept a new argumentstrip_root=True
to unzip moving all the files to the parent folder when all of them belongs to a single folder.Docs: conan-io/docs#1967
Closes #6479
When a zip file structure is the following:
If you use the
flat_folder=True
it will extract: