package/python3: add optional support for lib2to3
authorBernd Kuhls <bernd.kuhls@t-online.de>
Sun, 3 Jan 2021 15:03:06 +0000 (16:03 +0100)
committerYann E. MORIN <yann.morin.1998@free.fr>
Sun, 3 Jan 2021 21:57:29 +0000 (22:57 +0100)
Kodi is in transition to support python3 instead of python2:
https://kodi.wiki/view/General_information_about_migration_to_Python_3

"For Kodi 18 (Leia), only addons that are compatible with both Python 2
 and 3 will be accepted to the official addon repository."

Some of these addons depend on the Kodi addon script.module.future to
provide support for both python versions.

The script.module.future addon contains python-future:
https://kodi.wiki/view/General_information_about_migration_to_Python_3#Future
which in turn needs lib2to3 to be included in the target build of
python3: http://python-future.org/automatic_conversion.html

Kodi addons depending on the script.module.future addon are crashing on
buildroot due to lib2to3 missing in the build.

LibreELEC added lib2to3 to python3 to fix the problem:
https://forum.libreelec.tv/thread/21239-lib2to3-pgen2-parse-missing/
https://github.com/LibreELEC/LibreELEC.tv/pull/4146

This patch provides the Config.in option to be used by Kodi 19.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[yann.morin.1998@free.fr:
  - fix conflicts due to local changes in author's tree
  - fix typ in variabl name (PYTHON_CONF_OPTS -> PYTHON3_CONF_OPTS)
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
package/python3/Config.in
package/python3/python3.mk

index 0c5018f0b326a163b9b09428af18a1308463d0a4..3a9dd4b2f42e7afd1c1e45bbb03d4dfbf22f13b9 100644 (file)
@@ -41,6 +41,11 @@ menu "core python3 modules"
 
 comment "The following modules are unusual or require extra libraries"
 
+config BR2_PACKAGE_PYTHON3_2TO3
+       bool "2to3 module"
+       help
+         code translation from python 2 to 3
+
 config BR2_PACKAGE_PYTHON3_BZIP2
        bool "bz2 module"
        select BR2_PACKAGE_BZIP2
index f2516dee906b888626ee0b264dbad3e5f19ea8cb..8dbd0bab6628309f76fd85fa142405ef8f902368 100644 (file)
@@ -49,6 +49,12 @@ endif
 
 PYTHON3_INSTALL_STAGING = YES
 
+ifeq ($(BR2_PACKAGE_PYTHON3_2TO3),y)
+PYTHON3_CONF_OPTS += --enable-lib2to3
+else
+PYTHON3_CONF_OPTS += --disable-lib2to3
+endif
+
 ifeq ($(BR2_PACKAGE_PYTHON3_READLINE),y)
 PYTHON3_DEPENDENCIES += readline
 else
@@ -156,7 +162,6 @@ PYTHON3_CONF_OPTS += \
        --with-system-ffi \
        --disable-pydoc \
        --disable-test-modules \
-       --disable-lib2to3 \
        --disable-tk \
        --disable-nis \
        --disable-idle3 \