Skip to contentSkip to conversation

package/python3: add optional dependency to gettext

PATCH New Bernd Kuhls 3 participants 5 messages Apr 5, 2020 – Apr 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/python3: add optional dependency to gettext

Tested using this defconfig:

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_SYSTEM_ENABLE_NLS=y
BR2_PACKAGE_PYTHON3=y

Without this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

With this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libintl.so.8]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

---
v2: unchanged, added to series

 package/python3/python3.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/python3/python3.mk +4 -0
index d12237300d..2656037efd 100644
@@ -146,6 +146,10 @@ ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
 PYTHON3_CONF_ENV += ac_cv_func_wcsftime=no
 endif
 
+ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
+PYTHON3_DEPENDENCIES += gettext
+endif
+
 PYTHON3_CONF_OPTS += \
 	--without-ensurepip \
 	--without-cxx-main \
Signature · 1 line
2.25.0
#1 lore raw

PATCH 2/2 package/python3: add optional support for berkeleydb

Tested using this defconfig:

BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_BERKELEYDB=y

Without this patch:

$ ls -la output/target/usr/lib/python3.8/lib-dynload | grep dbm
$

With this patch:

$ ls -la output/target/usr/lib/python3.8/lib-dynload | grep dbm
-rwxr-xr-x  1 bernd bernd   95240 Apr  5 16:19 _dbm.cpython-38-x86_64-linux-gnu.so
---
 package/python3/python3.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/python3/python3.mk +4 -0
index 2656037efd..98c78bb156 100644
@@ -150,6 +150,10 @@ ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
 PYTHON3_DEPENDENCIES += gettext
 endif
 
+ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
+PYTHON3_DEPENDENCIES += berkeleydb
+endif
+
 PYTHON3_CONF_OPTS += \
 	--without-ensurepip \
 	--without-cxx-main \
Signature · 1 line
2.25.0
#2 lore raw

PATCH 2/2 package/python3: add optional support for berkeleydb

Hello Bernd,

package/python3/python3.mk ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y) · line 155

Quoted 3 lines · On Sun, 5 Apr 2020 16:28:23 +0200 Bernd Kuhls <[email protected]> wrote:
package/python3/python3.mk +3 -0
+ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
+PYTHON3_DEPENDENCIES += berkeleydb
+endif

For all Python modules that have external dependencies, we like to have an option that allows to explicitly disable it:

0018-Add-an-option-to-disable-the-curses-module.patch 0019-Add-an-option-to-disable-expat.patch 0020-Add-an-option-to-disable-CJK-codecs.patch 0021-Add-an-option-to-disable-NIS.patch 0022-Add-an-option-to-disable-unicodedata.patch 0023-Add-an-option-to-disable-IDLE.patch 0024-Add-an-option-to-disable-decimal.patch 0025-Add-an-option-to-disable-the-ossaudiodev-module.patch 0026-Add-an-option-to-disable-openssl-support.patch 0027-Add-an-option-to-disable-the-readline-module.patch 0028-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch

Could you add a similar patch to explicitly disable the build of the dbm module when berkeleydb is not available, and then use that new option in python3.mk ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/2 package/python3: add optional dependency to gettext

In reply to Bernd Kuhls
Quoted 10 lines · On Sun, 5 Apr 2020 16:28:22 +0200 Bernd Kuhls <[email protected]> wrote:

Tested using this defconfig:

BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_SYSTEM_ENABLE_NLS=y
BR2_PACKAGE_PYTHON3=y

Without this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]
Quoted 8 lines

With this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libintl.so.8]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

---
v2: unchanged, added to series

I was hesitating between applying this, and using TARGET_NLS_DEPENDENCIES. But after looking a bit deeper, Python doesn't really use a standard NLS support, it really checks specifically for libintl, so I've applied your patch.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH v2 1/2 package/python3: add optional dependency to gettext

In reply to Bernd Kuhls
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bernd" == Bernd Kuhls <[email protected]> writes:

Tested using this defconfig:
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_SYSTEM_ENABLE_NLS=y
BR2_PACKAGE_PYTHON3=y

Without this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]
Quoted 8 lines

With this patch:

$ readelf -a output/target/usr/lib/libpython3.8.so.1.0 | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libintl.so.8]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

---
v2: unchanged, added to series

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard