From cdb2cc955da8ae4f07df281f02357466150d5290 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Mon, 26 Jan 2015 14:36:08 +0100 Subject: remove unused code --- mgagnome | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/mgagnome b/mgagnome index 7fed651..c77f6d6 100755 --- a/mgagnome +++ b/mgagnome @@ -22,12 +22,6 @@ import shutil # version comparison: import rpm -# opening tarballs: -import tarfile -import gzip -import bz2 -import lzma # pyliblzma - # getting links from HTML document: from html.parser import HTMLParser import urllib.request, urllib.error, urllib.parse @@ -284,40 +278,6 @@ class urllister(HTMLParser): if href: self.urls.extend(href) -class XzTarFile(tarfile.TarFile): - - OPEN_METH = tarfile.TarFile.OPEN_METH.copy() - OPEN_METH["xz"] = "xzopen" - - @classmethod - def xzopen(cls, name, mode="r", fileobj=None, **kwargs): - """Open gzip compressed tar archive name for reading or writing. - Appending is not allowed. - """ - if len(mode) > 1 or mode not in "rw": - raise ValueError("mode must be 'r' or 'w'") - - if fileobj is not None: - fileobj = _LMZAProxy(fileobj, mode) - else: - fileobj = lzma.LZMAFile(name, mode) - - try: - # lzma doesn't immediately return an error - # try and read a bit of data to determine if it is a valid xz file - fileobj.read(_LZMAProxy.blocksize) - fileobj.seek(0) - t = cls.taropen(name, mode, fileobj, **kwargs) - except IOError: - raise tarfile.ReadError("not a xz file") - except lzma.error: - raise tarfile.ReadError("not a xz file") - t._extfileobj = False - return t - -if not hasattr(tarfile.TarFile, 'xzopen'): - tarfile.open = XzTarFile.open - def is_valid_hash(path, algo, hexdigest): if algo not in hashlib.algorithms_available: raise ValueError("Unknown hash algorithm: %s" % algo) -- cgit v1.2.1