It happened to me several time : re-write a small function to archive a directory, to mimic "tar -xzvf archive.tgz directory"
What about adding in tarfile this small function:
def archive_tree(archive_name, src_dir [[, add_empty_dir], callable]) -> creates an archive that contains the files in directory, by recursively walking into it.
if add_empty_dir is set to False (default: True), empty directory founded will not be added
if callable is provided, it will be triggered everytime a file is added in the archive and will return True or False
If False, the file will not be added