diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-12-11 19:08:29 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-12-11 19:08:29 +0000 |
commit | f0ad2e331ce0524d36f59f3dee5cf85e6b22b089 (patch) | |
tree | 4529da2d909a6057dc49e56b10c5a6cd32c343c6 | |
parent | f342d39e714c0d9bf7567028766410a9a71b7ea5 (diff) | |
download | sos-f0ad2e331ce0524d36f59f3dee5cf85e6b22b089.tar.gz |
[archive] remove all references to ZipFileArchive
Commit f342d39 removed ZipFileArchive and the test suite references
but left several imports in other files. Remove them and attendant
support functions.
Fixes #449.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/archive.py | 1 | ||||
-rw-r--r-- | sos/sosreport.py | 2 | ||||
-rw-r--r-- | sos/utilities.py | 39 |
3 files changed, 3 insertions, 39 deletions
diff --git a/sos/archive.py b/sos/archive.py index 19638981..6ef46a9d 100644 --- a/sos/archive.py +++ b/sos/archive.py @@ -18,7 +18,6 @@ import os import time import tarfile -import zipfile import shutil import logging import shlex diff --git a/sos/sosreport.py b/sos/sosreport.py index a6973800..0dd26ad1 100644 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -37,7 +37,7 @@ import tempfile from sos import _sos as _ from sos import __version__ import sos.policies -from sos.archive import TarFileArchive, ZipFileArchive +from sos.archive import TarFileArchive from sos.reporting import (Report, Section, Command, CopiedFile, CreatedFile, Alert, Note, PlainTextReport) diff --git a/sos/utilities.py b/sos/utilities.py index 8cb4ed6d..51909c64 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -18,7 +18,6 @@ import os import re import inspect from subprocess import Popen, PIPE, STDOUT -import zipfile import hashlib import logging import fnmatch @@ -191,8 +190,8 @@ def shell_out(cmd, runat=None): class ImporterHelper(object): """Provides a list of modules that can be imported in a package. Importable modules are located along the module __path__ list and modules - are files that end in .py. This class will read from PKZip archives as well - for listing out jar and egg contents.""" + are files that end in .py. + """ def __init__(self, package): """package is a package module @@ -223,38 +222,6 @@ class ImporterHelper(object): else: return [] - def _get_path_to_zip(self, path, tail_list=None): - if not tail_list: - tail_list = [''] - - if path.endswith(('.jar', '.zip', '.egg')): - return path, os.path.join(*tail_list) - - head, tail = os.path.split(path) - tail_list.insert(0, tail) - - if head == path: - raise Exception("not a zip file") - else: - return self._get_path_to_zip(head, tail_list) - - def _find_plugins_in_zipfile(self, path): - try: - path_to_zip, tail = self._get_path_to_zip(path) - zf = zipfile.ZipFile(path_to_zip) - # the path will have os separators, but the zipfile will - # always have '/' - tail = tail.replace(os.path.sep, "/") - root_names = [name for name in zf.namelist() if tail in name] - candidates = self._get_plugins_from_list(root_names) - zf.close() - if candidates: - return candidates - else: - return [] - except (IOError, Exception): - return [] - def get_modules(self): """Returns the list of importable modules in the configured python package. """ @@ -262,8 +229,6 @@ class ImporterHelper(object): for path in self.package.__path__: if os.path.isdir(path) or path == '': plugins.extend(self._find_plugins_in_dir(path)) - else: - plugins.extend(self._find_plugins_in_zipfile(path)) return plugins |