Enable Python3 module lzma (xz)

Unlike LE, CE does seem to package Python3 binaries. However, the stdlib module lzma is not built/installed. As you may know this module would be a tremendous help in writing a Rytec EPG download tool. So could I ask to enable this module for the Python3 package? Thanks.

You can install the python3-lzma that comes with entware with:
opkg install python3-lzma

Here is the patch to compile python3 with lzma support:

diff --git a/packages/lang/Python3/package.mk b/packages/lang/Python3/package.mk
index 9796c5c..c91c23e 100644
--- a/packages/lang/Python3/package.mk
+++ b/packages/lang/Python3/package.mk
@@ -10,8 +10,8 @@ PKG_LICENSE="OSS"
-PKG_DEPENDS_HOST="zlib:host bzip2:host libffi:host util-linux:host"
-PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 openssl Python3:host readline ncurses"
+PKG_DEPENDS_HOST="zlib:host bzip2:host xz:host libffi:host util-linux:host"
+PKG_DEPENDS_TARGET="toolchain sqlite expat zlib bzip2 xz openssl Python3:host readline ncurses"
 PKG_SHORTDESC="python3: The Python3 programming language"
 PKG_LONGDESC="Python3 is an interpreted object-oriented programming language, and is often compared with Tcl, Perl, Java or Scheme."
@@ -69,7 +69,7 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_prog_HAS_HG=/bin/false
-                           --disable-xz
+                           --enable-xz

I tested this python sample:

import lzma
with lzma.open('test.tar.xz') as f:
    file_content = f.read()

with python3 + python3-lzma from entware and a coreelec build with the above patch and worked on both cases.

First of all, thanks for the pointer to entware. With the patch you posted, is entware even necessary to get Python3 with lzma?

No. If you can compile your own build go ahead, but with the entware route you’ll have it running after less than a minute.

Of course. I misunderstood the statement «python3 + python3-lzma from entware and a coreelec build with the above patch» (my emphasis)