From fc6f830088992ca7300b5c275db4206905061323 Mon Sep 17 00:00:00 2001 From: Carson Gaspar Date: Sat, 4 Jan 2020 05:20:16 -0800 Subject: [PATCH] Update lzma import to include calibre >= 4.6.0 --- dedrm_src/ion.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dedrm_src/ion.py b/dedrm_src/ion.py index 40433ca..c361d20 100644 --- a/dedrm_src/ion.py +++ b/dedrm_src/ion.py @@ -21,19 +21,24 @@ from Crypto.Cipher import AES from Crypto.Util.py3compat import bchr, bord try: - # lzma library from calibre 2.35.0 or later - import lzma.lzma1 as calibre_lzma + # lzma library from calibre 4.6.0 or later + import calibre_lzma.lzma1 as calibre_lzma except ImportError: calibre_lzma = None + # lzma library from calibre 2.35.0 or later try: - import lzma + import lzma.lzma1 as calibre_lzma except ImportError: - # Need pip backports.lzma on Python <3.3 + calibre_lzma = None try: - from backports import lzma + import lzma except ImportError: - # Windows-friendly choice: pylzma wheels - import pylzma as lzma + # Need pip backports.lzma on Python <3.3 + try: + from backports import lzma + except ImportError: + # Windows-friendly choice: pylzma wheels + import pylzma as lzma TID_NULL = 0