From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id DC56A13888F for ; Fri, 9 Oct 2015 21:06:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 734C021C00C; Fri, 9 Oct 2015 21:06:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0924021C00C for ; Fri, 9 Oct 2015 21:06:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EED2B340564 for ; Fri, 9 Oct 2015 21:06:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D3A5CDCD for ; Fri, 9 Oct 2015 21:06:09 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1444368411.0a9a9e359e9677e2ebea5a23fe3f0179ae392217.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/contents.py X-VCS-Directories: catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 0a9a9e359e9677e2ebea5a23fe3f0179ae392217 X-VCS-Branch: master Date: Fri, 9 Oct 2015 21:06:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: efdce8ee-6d43-4826-9cf2-6700482e991d X-Archives-Hash: ff80dd1a8d851a37347a1ca1d2dcb7d5 commit: 0a9a9e359e9677e2ebea5a23fe3f0179ae392217 Author: Mike Frysinger gentoo org> AuthorDate: Fri Oct 9 05:26:51 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Oct 9 05:26:51 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=0a9a9e35 contents: punt unused module It looks like this code has all been moved to the external DeComp pkg. catalyst/contents.py | 87 ---------------------------------------------------- 1 file changed, 87 deletions(-) diff --git a/catalyst/contents.py b/catalyst/contents.py deleted file mode 100644 index 73eda61..0000000 --- a/catalyst/contents.py +++ /dev/null @@ -1,87 +0,0 @@ - -from collections import namedtuple -from subprocess import Popen, PIPE - -from catalyst.support import CatalystError, warn - - -# use ContentsMap.fields for the value legend -# Key:[function, cmd] -CONTENTS_DEFINITIONS = { - # 'find' is disabled because it requires the source path, which is not - # always available - #"find" :["calc_contents","find %(path)s"], - "tar_tv":["calc_contents","tar --xattrs tvf %(file)s"], - "tar_tvz":["calc_contents","tar --xattrs tvzf %(file)s"], - "tar_tvj":["calc_contents","tar --xattrs -I lbzip2 -tvf %(file)s"], - "isoinfo_l":["calc_contents","isoinfo -l -i %(file)s"], - # isoinfo_f should be a last resort only - "isoinfo_f":["calc_contents","isoinfo -f -i %(file)s"], -} - - -class ContentsMap(object): - '''Class to encompass all known commands to list - the contents of an archive''' - - - fields = ['func', 'cmd'] - - - def __init__(self, defs=None): - '''Class init - - @param defs: dictionary of Key:[function, cmd] - ''' - if defs is None: - defs = {} - #self.contents = {} - self.contents_map = {} - - # create the archive type namedtuple classes - for name in list(defs): - #obj = self.contents[name] = namedtuple(name, self.fields) - obj = namedtuple(name, self.fields) - obj.__slots__ = () - self.contents_map[name] = obj._make(defs[name]) - del obj - - - def generate_contents(self, file_, getter="auto", verbose=False): - try: - archive = getter - if archive == 'auto' and file_.endswith('.iso'): - archive = 'isoinfo_l' - if (archive in ['tar_tv','auto']): - if file_.endswith('.tgz') or file_.endswith('.tar.gz'): - archive = 'tar_tvz' - elif file_.endswith('.tbz2') or file_.endswith('.tar.bz2'): - archive = 'tar_tvj' - elif file_.endswith('.tar'): - archive = 'tar_tv' - - if archive == 'auto': - warn('File %r has unknown type for automatic detection.' - % (file_, )) - return None - else: - getter = archive - func = getattr(self, '_%s_' % self.contents_map[getter].func) - return func(file_, self.contents_map[getter].cmd, verbose) - except: - raise CatalystError( - "Error generating contents, is appropriate utility " + - "(%s) installed on your system?" - % (self.contents_map[getter].cmd), print_traceback=True) - - - @staticmethod - def _calc_contents_(file_, cmd, verbose): - _cmd = (cmd % {'file': file_ }).split() - proc = Popen(_cmd, stdout=PIPE, stderr=PIPE) - results = proc.communicate() - result = "\n".join(results) - if verbose: - print result - return result -