]> git.ipfire.org Git - pakfire.git/commitdiff
Drop unused compression module
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Feb 2021 15:05:41 +0000 (15:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Feb 2021 15:05:41 +0000 (15:05 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/pakfire/compress.py [deleted file]

index 4727ce55be616b16cfaef41cf2a290bad8d85a3e..e5e6ebea116c4dba337f01fa5152e315db805af7 100644 (file)
@@ -120,7 +120,6 @@ pakfire_PYTHON = \
        src/pakfire/cgroups.py \
        src/pakfire/client.py \
        src/pakfire/cli.py \
-       src/pakfire/compress.py \
        src/pakfire/config.py \
        src/pakfire/constants.py \
        src/pakfire/daemon.py \
diff --git a/src/pakfire/compress.py b/src/pakfire/compress.py
deleted file mode 100644 (file)
index df6cf1c..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/python3
-###############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2011 Pakfire development team                                 #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-import lzma
-
-from .constants import *
-from .i18n import _
-
-ALGO_DEFAULT = "xz"
-
-# A dictionary with all compression types
-# we do support.
-# XXX add bzip2, and more here.
-MAGICS = {
-       #"gzip"  : "\037\213\010",
-       "xz"    : "\xfd7zXZ",
-}
-
-FILES = {
-       "xz"    : lzma.LZMAFile,
-}
-
-COMPRESSORS = {
-       "xz"    : lzma.LZMACompressor
-}
-
-DECOMPRESSORS = {
-       "xz"    : lzma.LZMADecompressor,
-}
-
-def guess_algo(name=None, fileobj=None):
-       """
-               This function takes a filename or a file descriptor
-               and tells the name of the algorithm the file was
-               compressed with.
-               If an unknown or no compression was used, None is returned.
-       """
-       ret = None
-
-       if name:
-               fileobj = open(file)
-
-       # Save position of pointer.
-       pos = fileobj.tell()
-
-       # Iterate over all algoriths and their magic values
-       # and check for a match.
-       for algo, magic in list(MAGICS.items()):
-               fileobj.seek(0)
-
-               start_sequence = fileobj.read(len(magic))
-               if start_sequence == magic:
-                       ret = algo
-                       break
-
-       # Reset file pointer.
-       fileobj.seek(pos)
-
-       if name:
-               fileobj.close()
-
-       return ret
-
-def decompressobj(name=None, fileobj=None, algo=ALGO_DEFAULT):
-       f_cls = FILES.get(algo, None)
-       if not f_cls:
-               raise CompressionError(_("Given algorithm '%s' is not supported."))
-
-       f = f_cls(name, fileobj=fileobj, mode="r")
-
-       return f
-
-
-def compressobj(name=None, fileobj=None, algo=ALGO_DEFAULT):
-       f_cls = FILES.get(algo, None)
-       if not f_cls:
-               raise CompressionError(_("Given algorithm '%s' is not supported."))
-
-       f = f_cls(name, fileobj=fileobj, mode="w")
-
-       return f