# -*- coding: utf-8 -*-""" vcs.utils.archivers ~~~~~~~~~~~~~~~~~~~ set of archiver functions for creating archives from repository content :created_on: Jan 21, 2011 :copyright: (c) 2010-2011 by Marcin Kuzminski, Lukasz Balcerzak."""classBaseArchiver(object):def__init__(self):self.archive_file=self._get_archive_file()defaddfile(self):""" Adds a file to archive container """passdefclose(self):""" Closes and finalizes operation of archive container object """self.archive_file.close()def_get_archive_file(self):""" Returns container for specific archive """raiseNotImplementedError()classTarArchiver(BaseArchiver):passclassTbz2Archiver(BaseArchiver):passclassTgzArchiver(BaseArchiver):passclassZipArchiver(BaseArchiver):passdefget_archiver(self,kind):""" Returns instance of archiver class specific to given kind :param kind: archive kind """archivers={'tar':TarArchiver,'tbz2':Tbz2Archiver,'tgz':TgzArchiver,'zip':ZipArchiver,}returnarchivers[kind]()