Skip to contentSkip to conversation

package/python-zlmdb: select python3 zlib support

PATCH In review Yegor Yefremov via buildroot 2 participants 6 messages Oct 13 – Oct 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/python-zlmdb: select python3 zlib support

zlmdb/_pmap.py unconditionally imports the zlib module, so importing zlmdb fails without it:

ModuleNotFoundError: No module named 'zlib'

Select BR2_PACKAGE_PYTHON3_ZLIB.

Assisted-by Claude:claude-opus-5-5
---
 package/python-zlmdb/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/python-zlmdb/Config.in +1 -0
index 884cfff182..1edf993ecd 100644
@@ -5,6 +5,7 @@ config BR2_PACKAGE_PYTHON_ZLMDB
 	depends on BR2_INSTALL_LIBSTDCPP # python-numpy
 	depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL # python-numpy
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9 # python-numpy
+	select BR2_PACKAGE_PYTHON3_ZLIB # runtime
 	select BR2_PACKAGE_PYTHON_CBOR2 # runtime
 	select BR2_PACKAGE_PYTHON_CFFI # runtime
 	select BR2_PACKAGE_PYTHON_CLICK # runtime
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/python-zlmdb: bump to version 26.7.1

Version 23.1.1 ships a vendored copy of flatbuffers as a top-level "flatbuffers" package, which conflicts with python-flatbuffers that python-zlmdb itself selects:

FileExistsError: File already exists: .../target/usr/lib/python3.14/site-packages/flatbuffers/__init__.py

Starting with this release the flatbuffers runtime is vendored as zlmdb.flatbuffers, and py-lmdb plus a patched LMDB are vendored as zlmdb._lmdb_vendor, built as a CFFI extension. Thus drop the python-flatbuffers and python-lmdb selects.

The build system switched to hatchling. The build hook needs host cffi and setuptools to compile the LMDB extension and uses cmake to build the bundled flatc compiler.

Update the license information to cover the bundled LMDB, py-lmdb and flatbuffers code.

Changelog: https://github.com/crossbario/zlmdb/blob/master/docs/changelog.rst

Assisted-by Claude:claude-opus-5-5
---
 package/python-zlmdb/Config.in         |  2 --
 package/python-zlmdb/python-zlmdb.hash |  7 ++++---
 package/python-zlmdb/python-zlmdb.mk   | 15 ++++++++++-----
 3 files changed, 14 insertions(+), 10 deletions(-)
package/python-zlmdb/Config.in +0 -2
index 1edf993ecd..f6b8caebcb 100644
@@ -9,8 +9,6 @@ config BR2_PACKAGE_PYTHON_ZLMDB
 	select BR2_PACKAGE_PYTHON_CBOR2 # runtime
 	select BR2_PACKAGE_PYTHON_CFFI # runtime
 	select BR2_PACKAGE_PYTHON_CLICK # runtime
-	select BR2_PACKAGE_PYTHON_FLATBUFFERS # runtime
-	select BR2_PACKAGE_PYTHON_LMDB # runtime
 	select BR2_PACKAGE_PYTHON_NUMPY # runtime
 	select BR2_PACKAGE_PYTHON_PYNACL # runtime
 	select BR2_PACKAGE_PYTHON_PYYAML # runtime
package/python-zlmdb/python-zlmdb.hash +4 -3
index ed1b6db8c2..e29bbea280 100644
@@ -1,5 +1,6 @@
 # md5, sha256 from https://pypi.org/pypi/zlmdb/json
-md5  4d96b46d1724b9d4cb6961874e5b4a9a  zlmdb-23.1.1.tar.gz
-sha256  ddcf680bf49352cabe35bfb5bfe3acbd5d6b8d481cafa508c423e0b18d654d05  zlmdb-23.1.1.tar.gz
+md5  186642d7df261a781631a734244f785e  zlmdb-26.7.1.tar.gz
+sha256  3cbc9447cfbf3b33dad0a30f7e671d467d72b41e5bc4e999b4f41914eff5fcb9  zlmdb-26.7.1.tar.gz
 # Locally computed sha256 checksums
-sha256  8a139bf325dcca11e0e476ce537bf791a6cfbeed8899a9b6ddc55238e180d230  LICENSE
+sha256  0ba0c0c595fd01ee19478ca417f210b75740f9b84ca937ebf783154e1cc01174  LICENSE
+sha256  cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30  deps/flatbuffers/LICENSE
package/python-zlmdb/python-zlmdb.mk +10 -5
index 70538ce63c..da625f9777 100644
@@ -4,11 +4,16 @@
 #
 ################################################################################
 
-PYTHON_ZLMDB_VERSION = 23.1.1
+PYTHON_ZLMDB_VERSION = 26.7.1
 PYTHON_ZLMDB_SOURCE = zlmdb-$(PYTHON_ZLMDB_VERSION).tar.gz
-PYTHON_ZLMDB_SITE = https://files.pythonhosted.org/packages/56/b2/abaeb5419435a6224a0beb2b5edad621ec975fe4802297963ecf1728b883
-PYTHON_ZLMDB_SETUP_TYPE = setuptools
-PYTHON_ZLMDB_LICENSE = MIT
-PYTHON_ZLMDB_LICENSE_FILES = LICENSE
+PYTHON_ZLMDB_SITE = https://files.pythonhosted.org/packages/87/21/5b877e438d652f78bcf88aec83474b373f8ab1b98b6c0c5d47db3481d6b0
+PYTHON_ZLMDB_SETUP_TYPE = hatch
+PYTHON_ZLMDB_LICENSE = MIT, OLDAP-2.8 (bundled lmdb, py-lmdb), Apache-2.0 (bundled flatbuffers)
+PYTHON_ZLMDB_LICENSE_FILES = LICENSE deps/flatbuffers/LICENSE
+# cmake is used to build the bundled flatc compiler
+PYTHON_ZLMDB_DEPENDENCIES = \
+	$(BR2_CMAKE_HOST_DEPENDENCY) \
+	host-python-cffi \
+	host-python-setuptools
 
 $(eval $(python-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/python-zlmdb: bump to version 26.7.1

Quoted 11 lines · Yegor Yefremov

Version 23.1.1 ships a vendored copy of flatbuffers as a top-level "flatbuffers" package, which conflicts with python-flatbuffers that python-zlmdb itself selects:

FileExistsError: File already exists: .../target/usr/lib/python3.14/site-packages/flatbuffers/__init__.py

Starting with this release the flatbuffers runtime is vendored as zlmdb.flatbuffers, and py-lmdb plus a patched LMDB are vendored as zlmdb._lmdb_vendor, built as a CFFI extension. Thus drop the python-flatbuffers and python-lmdb selects.

Quoted 8 lines

The build system switched to hatchling. The build hook needs host cffi and setuptools to compile the LMDB extension and uses cmake to build the bundled flatc compiler.

Update the license information to cover the bundled LMDB, py-lmdb and flatbuffers code.

When was the problem introduced? I.e does the problem exist in 2025.02.x?

It's always a bit annoying to have to do a major bump to fix an issue, as it's more risk in terms of backporting to an LTS branch;

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/2] package/python-zlmdb: bump to version 26.7.1

Hi Thomas,

Quoted 17 lines · Thomas Petazzoni
Quoted 15 lines · Yegor Yefremov

Version 23.1.1 ships a vendored copy of flatbuffers as a top-level "flatbuffers" package, which conflicts with python-flatbuffers that python-zlmdb itself selects:

FileExistsError: File already exists: .../target/usr/lib/python3.14/site-packages/flatbuffers/__init__.py

Starting with this release the flatbuffers runtime is vendored as zlmdb.flatbuffers, and py-lmdb plus a patched LMDB are vendored as zlmdb._lmdb_vendor, built as a CFFI extension. Thus drop the python-flatbuffers and python-lmdb selects.

The build system switched to hatchling. The build hook needs host cffi and setuptools to compile the LMDB extension and uses cmake to build the bundled flatc compiler.

Quoted 7 lines
Quoted 4 lines

Update the license information to cover the bundled LMDB, py-lmdb and flatbuffers code.

When was the problem introduced? I.e does the problem exist in 2025.02.x?

Yes. zlmdb has installed its own top-level "flatbuffers" package next to python-flatbuffers since the package was added (acf68180de66, 2022.08). The overlap became fatal with 8937db8dd595 ("package/pkg-python.mk:
migrate setuptools to pep517"), which is in 2024.05 and later: the pep517 installer refuses to overwrite existing files.

The autobuilders have hit it 38 times since April 2024, including on the LTS branches:

2025.02.x: https://autobuild.buildroot.org/results/ddb5004db38c212240e1b35f06511815e311a9ba
2026.02.x: https://autobuild.buildroot.org/results/022153708f4e7e91d3901e49804b11cc4028c817

Quoted 2 lines

It's always a bit annoying to have to do a major bump to fix an issue, as it's more risk in terms of backporting to an LTS branch;

Agreed. v2 adds a minimal fix before the bump: a one-line setup.py patch so zlmdb 23.1.1 doesn't install its copy of flatbuffers and uses python-flatbuffers instead. The bump then drops that patch again. Patch 2/3 cherry-picks cleanly onto 2025.02.x.

I tested it on master and 2025.02.x (bootlin-x86-64-musl and bootlin-armv7-glibc):

- without the patch, reinstalling python-zlmdb on top of python-flatbuffers reproduces the FileExistsError on both branches; with the patch it installs fine
- zlmdb works with python-flatbuffers from each branch (25.9.23 on master, 2.0.7 on 2025.02.x): all zlmdb modules import, and a FlatBuffers table survives an LMDB round trip on the target Python

Yegor
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Yegor Yefremov via buildroot
Quoted 9 lines · Yegor Yefremov via buildroot

zlmdb/_pmap.py unconditionally imports the zlib module, so importing zlmdb fails without it:

ModuleNotFoundError: No module named 'zlib'

Select BR2_PACKAGE_PYTHON3_ZLIB.

Assisted-by Claude:claude-opus-5-5

Usual request: when providing a fix, always include the information of which commit introduced the problem. If it has been a problem since the package was added, the Fixes: tag can point to the commit adding the package.

Without this information, LTS maintainers will have to dig themselves into this to figure out whether this fix needs to be backported or not, and our LTS maintainers already have to crawl through hundreds of commits, so let's make their life easier :)

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Hi Thomas,

Quoted 17 lines · Thomas Petazzoni
Quoted 9 lines · Yegor Yefremov via buildroot

zlmdb/_pmap.py unconditionally imports the zlib module, so importing zlmdb fails without it:

ModuleNotFoundError: No module named 'zlib'

Select BR2_PACKAGE_PYTHON3_ZLIB.

Assisted-by Claude:claude-opus-5-5

Usual request: when providing a fix, always include the information of which commit introduced the problem. If it has been a problem since the package was added, the Fixes: tag can point to the commit adding the package.

Quoted 4 lines

Without this information, LTS maintainers will have to dig themselves into this to figure out whether this fix needs to be backported or not, and our LTS maintainers already have to crawl through hundreds of commits, so let's make their life easier :)

Sorry about that. The zlib import has been there since the package was added (22.3.1), so v2 adds:

Fixes acf68180de66 ("package/python-zlmdb: new package")

Yegor
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot