def archive(self, temp_dir):
"""Archive source directory to temp directory.
Return archive full path.
"""
# We want to achive `/my/sub/{some dir}` under unique temp dir:
# `/tmp/dEdjnr/{name from config}`
#
# So we make archive from base path `/my/sub/{some dir}`,
# root path `/my/sub/` and archive name
# `/tmp/dEdjnr/{name from config}`
from_path = self.settings['path']
base_name = self._prepare_data_path(temp_dir)
echo("... archive directory %s" % from_path)
arch_path = shutil.make_archive(
base_name=base_name,
root_dir=os.path.dirname(from_path),
base_dir=from_path,
# logger=log,
format=self.get_archive_format())
echo("... archived %s" % arch_path)
return arch_path
评论列表
文章目录