Skip to content

Commit

Permalink
Fix pkg_tar directory entries
Browse files Browse the repository at this point in the history
Directories appear to work for zip files but not tar files.

This should ensure we don't try to process directories as normal
files.

Fixes issues like:
rules_pkg/pkg/private/tar/tar_writer.py", line 242, in add_file
    with open(file_content, 'rb') as f:
IsADirectoryError: [Errno 21] Is a directory: 'bazel-out/darwin-fastbuild/bin/py/selenium/webdriver/common/devtools/v106'
  • Loading branch information
jameshilliard committed Dec 7, 2022
1 parent 8e65d2f commit c280c43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/private/tar/build_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ def add_manifest_entry(self, entry_list, file_attributes):
elif entry.entry_type == manifest.ENTRY_IS_EMPTY_FILE:
self.add_empty_file(entry.dest, **attrs)
else:
self.add_file(entry.src, entry.dest, **attrs)
if os.path.isdir(entry.src):
self.add_tree(entry.src, entry.dest, **attrs)
else:
self.add_file(entry.src, entry.dest, **attrs)


def main():
Expand Down

0 comments on commit c280c43

Please sign in to comment.