diff options
author | Alfred Wingate <parona@protonmail.com> | 2023-10-05 19:56:45 +0300 |
---|---|---|
committer | Alfred Wingate <parona@protonmail.com> | 2023-10-05 20:26:34 +0300 |
commit | 1d95e751bd8d0628f1b83ca667cc1d4cd18066a1 (patch) | |
tree | 134f1b2db2164e2ddd439b673103cffef261c5b6 /elogv | |
parent | Open files with same function to allow decompression to work seamlessly (diff) | |
download | elogv-1d95e751bd8d0628f1b83ca667cc1d4cd18066a1.tar.gz elogv-1d95e751bd8d0628f1b83ca667cc1d4cd18066a1.tar.bz2 elogv-1d95e751bd8d0628f1b83ca667cc1d4cd18066a1.zip |
Port to lzma
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Diffstat (limited to 'elogv')
-rwxr-xr-x | elogv | 12 |
1 files changed, 2 insertions, 10 deletions
@@ -33,6 +33,7 @@ import gettext import locale import gzip import bz2 +import lzma import signal _LOCALE_CATEGORY_PAIRS = ( @@ -46,12 +47,6 @@ _LOCALE_CATEGORY_PAIRS = ( (locale.LC_ALL, 'LC_ALL'), ) -no_liblzma = False -try: - import liblzma -except ImportError: - no_liblzma = True - def report_bad_locale(variable, value): py_version = '%s.%s.%s' % sys.version_info[:3] @@ -421,10 +416,7 @@ class ElogViewer: @staticmethod def open(file, mode='rt'): if file.endswith('.xz'): - if not no_liblzma: - return liblzma.LZMAFile(file) - else: - sys.exit('You need pyliblzma library to be able to read xz compressed elog files.\nhttp://pypi.python.org/pypi/pyliblzma') + return lzma.open(file, mode=mode) elif file.endswith('.gz'): return gzip.open(file, mode=mode) elif file.endswith('.bz2'): |