libmdbx 0.2.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {libmdbx-0.2.1 → libmdbx-0.3.2}/PKG-INFO +8 -5
  2. {libmdbx-0.2.1 → libmdbx-0.3.2}/README.md +2 -0
  3. {libmdbx-0.2.1 → libmdbx-0.3.2}/build_mdbx.py +50 -6
  4. libmdbx-0.3.2/libmdbx/dist/CMakeLists.txt +999 -0
  5. libmdbx-0.3.2/libmdbx/dist/COPYRIGHT +159 -0
  6. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/ChangeLog.md +1019 -86
  7. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/GNUmakefile +140 -49
  8. libmdbx-0.3.2/libmdbx/dist/LICENSE +177 -0
  9. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/Makefile +5 -4
  10. libmdbx-0.3.2/libmdbx/dist/NOTICE +43 -0
  11. libmdbx-0.3.2/libmdbx/dist/README.md +527 -0
  12. libmdbx-0.3.2/libmdbx/dist/VERSION.json +1 -0
  13. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/cmake/compiler.cmake +294 -178
  14. libmdbx-0.3.2/libmdbx/dist/cmake/profile.cmake +58 -0
  15. libmdbx-0.3.2/libmdbx/dist/cmake/utils.cmake +342 -0
  16. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/config.h.in +32 -5
  17. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_chk.1 +8 -8
  18. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_copy.1 +22 -2
  19. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_drop.1 +6 -6
  20. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_dump.1 +8 -8
  21. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_load.1 +8 -8
  22. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/man1/mdbx_stat.1 +7 -7
  23. libmdbx-0.3.2/libmdbx/dist/mdbx.c +37699 -0
  24. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx.c++ +1578 -2393
  25. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx.h +2013 -895
  26. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx.h++ +2273 -2283
  27. libmdbx-0.3.2/libmdbx/dist/mdbx_chk.c +3997 -0
  28. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx_copy.c +1298 -2101
  29. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx_drop.c +1278 -2087
  30. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx_dump.c +1368 -2191
  31. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx_load.c +1513 -2365
  32. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/mdbx_stat.c +1337 -2167
  33. libmdbx-0.3.2/libmdbx/dist/ut_and_examples/CMakeLists.txt +39 -0
  34. libmdbx-0.3.2/libmdbx/dist/ut_and_examples/README.md +11 -0
  35. libmdbx-0.3.2/libmdbx/dist/ut_and_examples/example-mdbx.c +167 -0
  36. libmdbx-0.3.2/libmdbx/dist/ut_and_examples/example-mdbx.c++ +99 -0
  37. libmdbx-0.3.2/libmdbx/dist/ut_and_examples/pcrf/pcrf_simulator.c +367 -0
  38. libmdbx-0.3.2/mdbx/__init__.py +17 -0
  39. {libmdbx-0.2.1 → libmdbx-0.3.2}/mdbx/mdbx.py +1028 -623
  40. libmdbx-0.3.2/platform_enums.c +20 -0
  41. {libmdbx-0.2.1 → libmdbx-0.3.2}/pyproject.toml +4 -2
  42. libmdbx-0.2.1/libmdbx/dist/CMakeLists.txt +0 -993
  43. libmdbx-0.2.1/libmdbx/dist/LICENSE +0 -47
  44. libmdbx-0.2.1/libmdbx/dist/README.md +0 -808
  45. libmdbx-0.2.1/libmdbx/dist/VERSION.txt +0 -1
  46. libmdbx-0.2.1/libmdbx/dist/cmake/profile.cmake +0 -55
  47. libmdbx-0.2.1/libmdbx/dist/cmake/utils.cmake +0 -286
  48. libmdbx-0.2.1/libmdbx/dist/mdbx.c +0 -35510
  49. libmdbx-0.2.1/libmdbx/dist/mdbx_chk.c +0 -5998
  50. libmdbx-0.2.1/mdbx/__init__.py +0 -4
  51. {libmdbx-0.2.1 → libmdbx-0.3.2}/LICENSE +0 -0
  52. {libmdbx-0.2.1 → libmdbx-0.3.2}/libmdbx/dist/ntdll.def +0 -0
@@ -1,18 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: libmdbx
3
- Version: 0.2.1
3
+ Version: 0.3.2
4
4
  Summary: The python bindings to libmdbx.
5
- Home-page: https://github.com/wtdcode/mdbx-py
5
+ License-File: LICENSE
6
6
  Keywords: mdbx,libmdbx,kvdb,bindings
7
7
  Author: lazymio
8
8
  Author-email: mio@lazym.io
9
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.10,<4.0
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.9
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Project-URL: Homepage, https://github.com/wtdcode/mdbx-py
16
17
  Description-Content-Type: text/markdown
17
18
 
18
19
  # Python bindings for libmdbx
@@ -32,6 +33,8 @@ Contributions and feedbacks are highly welcome.
32
33
  A quick sample to read all values from the default database:
33
34
 
34
35
  ```python
36
+ from mdbx import Env
37
+
35
38
  with Env(...) as env:
36
39
  with env.ro_transaction() as txn:
37
40
  with txn.cursor() as cur:
@@ -15,6 +15,8 @@ Contributions and feedbacks are highly welcome.
15
15
  A quick sample to read all values from the default database:
16
16
 
17
17
  ```python
18
+ from mdbx import Env
19
+
18
20
  with Env(...) as env:
19
21
  with env.ro_transaction() as txn:
20
22
  with txn.cursor() as cur:
@@ -6,6 +6,8 @@ import sys
6
6
  import multiprocessing
7
7
  import shutil
8
8
  import platform
9
+ import json
10
+ import re
9
11
 
10
12
  SO_FILE = {
11
13
  "linux": "libmdbx.so",
@@ -29,12 +31,14 @@ def build(setup_kws: dict):
29
31
  debug = "DEBUG" in os.environ
30
32
  pwd = Path(__file__).parent.resolve()
31
33
  out_lib = pwd / "mdbx" / "lib"
34
+ mdbx_py = pwd / "mdbx"/ "mdbx.py"
32
35
  libmdbx_source = pwd / "libmdbx"
33
36
  dist_folder = libmdbx_source / "dist"
37
+ platform_enums = pwd / "platform_enums.c"
34
38
 
35
39
  # If there is already dist
36
40
  if not dist_folder.exists():
37
- if sys.platform in ["linux", "linux2", "darwin"]:
41
+ if sys.platform in ["linux", "linux2"]:
38
42
  subprocess.check_call(["make", "dist"], cwd=libmdbx_source)
39
43
 
40
44
  if have_git() and (libmdbx_source / ".git").exists():
@@ -68,12 +72,19 @@ def build(setup_kws: dict):
68
72
  if sys.platform == "win32":
69
73
  plat = 'Win32' if platform.architecture()[0] == '32bit' else 'x64'
70
74
  cmake_gen += [
71
- "-G", "Visual Studio 16 2019",
72
- "-A", plat
75
+ "-G", "Visual Studio 17 2022",
76
+ "-A", plat,
77
+ # CMake >= 4.4 reports c_std_23 for MSVC, so libmdbx would pick
78
+ # /std:clatest, where MSVC chokes on the C23 attributes in mdbx.c.
79
+ "-DCMAKE_C_STANDARD=11"
73
80
  ]
74
81
 
75
82
  cmake_gen += [
76
- "-S", str(source_folder.absolute()), "-B", str(tmpdir_path.absolute())
83
+ "-S", str(source_folder.absolute()), "-B", str(tmpdir_path.absolute()),
84
+ # The non-amalgamated tree builds libmdbx's own test suite by default,
85
+ # which does not compile with MSVC: test/extra/rename_dbi.c wants
86
+ # unistd.h. We only ever consume the library itself.
87
+ "-DMDBX_ENABLE_TESTS=OFF"
77
88
  ]
78
89
  cmake_gen += build_type
79
90
  subprocess.check_call(
@@ -103,6 +114,39 @@ def build(setup_kws: dict):
103
114
  cwd=tmpdir_path
104
115
  )
105
116
  shutil.copy(tmpdir_path / conf / SO_FILE, out_lib)
106
-
117
+
118
+ enum_exe = tmpdir_path / "platform_enums"
119
+ if sys.platform == "win32":
120
+ enum_exe = enum_exe.with_suffix(".exe")
121
+ plat = 'Win32' if platform.architecture()[0] == '32bit' else 'x64'
122
+ conf = 'Debug' if debug else 'Release'
123
+ # Compile with MSVC
124
+ subprocess.check_call([
125
+ "cl", str(platform_enums),
126
+ f"/I{source_folder.absolute()}",
127
+ f"/Fe{enum_exe}"
128
+ ], cwd=tmpdir_path)
129
+ else:
130
+ # Compile with GCC/Clang
131
+ subprocess.check_call([
132
+ "gcc", str(platform_enums),
133
+ f"-I{source_folder.absolute()}",
134
+ "-o", str(enum_exe)
135
+ ], cwd=tmpdir_path)
136
+
137
+ output = subprocess.check_output([str(enum_exe)], text=True)
138
+ mdbx_errors = json.loads(output)
139
+
140
+ content = mdbx_py.read_text()
141
+
142
+ for key, value in mdbx_errors.items():
143
+ pattern = re.compile(rf"{key}\s*=\s*.*$", re.MULTILINE)
144
+ replacement = f"{key} = {value}"
145
+ content, n = pattern.subn(replacement, content)
146
+ if n == 0:
147
+ print(f"Warning: {key} not found in {mdbx_py}")
148
+
149
+ mdbx_py.write_text(content)
150
+
107
151
  if __name__ == "__main__":
108
- build({})
152
+ build({})