commit:     1d95e751bd8d0628f1b83ca667cc1d4cd18066a1
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Thu Oct  5 16:56:45 2023 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Thu Oct  5 17:26:34 2023 +0000
URL:        https://gitweb.gentoo.org/proj/elogv.git/commit/?id=1d95e751

Port to lzma

Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>

 elogv          | 12 ++----------
 pyproject.toml |  3 ---
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/elogv b/elogv
index b3455c7..94d466a 100755
--- a/elogv
+++ b/elogv
@@ -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'):

diff --git a/pyproject.toml b/pyproject.toml
index 88ad65f..0476844 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,6 +14,3 @@ dependencies = ["portage"]
 
 [project.urls]
 homepage = "https://gitweb.gentoo.org/proj/elogv.git/";
-
-[project.optional-dependencies]
-lzma = [ "pyliblzma" ]

Reply via email to