[pybsddb] Windows support for berkeleydb
Jesus Cea
jcea at jcea.es
Mon Jan 27 02:22:09 CET 2025
On 19/12/24 20:46, Brian Matthews wrote:
> Hi, thanks for responding.
>
> 1. Windows build
> If you just revert the change you made it will still not build on Windows. There are some minor syntax changes needed to make that happen. It has been like this for a long time!
Cool, Brian. Thanks for your explaining your patch.
Could you possibly do this:
1. Download BerkeleyDB 18.1.13, last release of the project:
https://pypi.org/project/berkeleydb/18.1.13/
2. Unpack it.
3. Replace "setup3.py" with this version:
<https://hg.jcea.es/pybsddb/file/15b0084cfa0a/setup3.py>. You can click
in the "raw" link in the left column.
4. Do your magic to compile it on windows.
Let me know if this new "setup3.py" is enough for you. If not, please,
send a patch relative to that "setup3.py" version.
> 2. Binary key
>
> The bsddb3 implementation used a str() variable which allowed to have binary characters. No NULL's as Berkekey will truncate it as you say. We use a randomly generated binary sequence.
> But the point is we have 000's of systems out there for 10-15 years that use this string or ones like it. And I cannot use it in berkeleydb python3 ports because it expects a python3 str() which is actually Unicode.
You can encode/decode to/from unicode using "latin-1" encoding, that
preserves bytes. For instance, try:
"""
>>> b'\x00\x01\x02\0xf1'.decode('latin-1').encode('latin-1')
b'\x00\x01\x02\x00xf1'
"""
All you would need to do to use a binary key would be to
"BINARY.decode('latin-1')". As long as there are not null characters. If
there are null characters, just truncate the encoding there.
Have you tried to follow instructions at
<https://docs.jcea.es/berkeleydb/latest/dbenv.html#set_encrypt>. If that
doesn't work, could you describe the problem? Maybe could your suggest
some rewording?
Thanks!
--
Jesús Cea Avión _/_/ _/_/_/ _/_/_/
jcea at jcea.es - https://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
Twitter: @jcea _/_/ _/_/ _/_/_/_/_/
jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
More information about the pybsddb
mailing list