Skip to content

Commit

Permalink
archive: remove handling of empty top-level dirs from 'make_archive_t…
Browse files Browse the repository at this point in the history
…gz' & 'make_archive_multitgz' (no longer special case).
  • Loading branch information
pjbriggs committed Feb 7, 2025
1 parent 85bba5e commit 9eb7e9e
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions ngsarchiver/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,12 +2081,6 @@ def make_archive_tgz(base_name,root_dir,base_dir=None,ext="tar.gz",
d = Directory(root_dir)
archive_name = "%s.%s" % (base_name,ext)
root_dir = d.path
if d.is_empty:
# Special case: directory is empty
logger.warning(f"{d.path}: creating archive for empty directory")
archive_name = "%s.%s" % (base_name, ext)
return make_empty_archive(archive_name, root_dir, base_dir=base_dir,
compresslevel=compresslevel)
with tarfile.open(archive_name,'w:gz',compresslevel=compresslevel) \
as tgz:
# Add entry for top-level directory
Expand Down Expand Up @@ -2165,12 +2159,6 @@ def make_archive_multitgz(base_name,root_dir,base_dir=None,
"""
d = Directory(root_dir)
max_size = convert_size_to_bytes(size)
if d.is_empty:
# Special case: directory is empty
logger.warning(f"{d.path}: creating archive for empty directory")
archive_name = "%s.00.%s" % (base_name, ext)
return [make_empty_archive(archive_name, root_dir, base_dir=base_dir,
compresslevel=compresslevel)]
# Initialise tar archive and add entry for top-level directory
indx = 0
archive_name = "%s.%02d.%s" % (base_name, indx, ext)
Expand Down

0 comments on commit 9eb7e9e

Please sign in to comment.