@@ -4,19 +4,20 @@ class PythonGdbmAT314 < Formula
44 url "https://www.python.org/ftp/python/3.14.4/Python-3.14.4.tgz"
55 sha256 "b4c059d5895f030e7df9663894ce3732bfa1b32cd3ab2883980266a45ce3cb3b"
66 license "Python-2.0"
7+ revision 1
78
89 livecheck do
910 formula "python@3.14"
1011 end
1112
1213 bottle do
13- sha256 cellar : :any , arm64_tahoe : "1bef27f3b0d3a83a41e0ff854052b560848f21c0ae08d19221fee8ceb7322511 "
14- sha256 cellar : :any , arm64_sequoia : "606abcbb6f1a952481671850346ef38b64e33bc76cc2f587ef3da89eb206898a "
15- sha256 cellar : :any , arm64_sonoma : "2f22db62ae2601143417c1ba4a575d4b3137bb03c49fea8f338d5e8ae083c0b8 "
16- sha256 cellar : :any , sequoia : "999aa26f8f53dba6ca07e765f7516dd5ef3b68d31c1c630508d6b30b176f564c "
17- sha256 cellar : :any , sonoma : "203e25fa170e365fdb196a0cd7aee90d7a877d59ce49f0227e5808292a4fa108 "
18- sha256 arm64_linux : "3030dc120dee0c17373bdf8024cfdf17dba4e459443d03fb0addaf56a5c9bf49 "
19- sha256 x86_64_linux : "08f842f1f18d922ee49c49ddae728e9659b34fa5b3284a0f060375e7212496ca "
14+ sha256 cellar : :any , arm64_tahoe : "af951802d8bc5eaff5946695ad920e07bd63bf42cc3adb39c5982492b20dce02 "
15+ sha256 cellar : :any , arm64_sequoia : "ce335535fc843258897a9ff3b5437fe803223548e478940aff325c8ea8229b75 "
16+ sha256 cellar : :any , arm64_sonoma : "179b4e15ef0bb92af5873b463c4c8cbf463a393ea798dbf089804bec6403e6a0 "
17+ sha256 cellar : :any , sequoia : "d4ba21e50a4100e0ec29f9bc03ec3287cbe4c3307363087b18ae626fe5b6a2c3 "
18+ sha256 cellar : :any , sonoma : "437dc8334c48f8cb6a72419558de2935232b97d5e3f807023605d6bc77f7c4a8 "
19+ sha256 arm64_linux : "5a732c7318b12eb0400d31a7a21de9de5230da97a1c618ff5228c1d8cfcda1ff "
20+ sha256 x86_64_linux : "28c28d97cb5f8adcfd5e62f7a126e79bf5b46c4a55d49c272243a1561f32c630 "
2021 end
2122
2223 depends_on "gdbm"
@@ -51,6 +52,16 @@ def install
5152 library-dirs = ["#{ Formula [ "gdbm" ] . opt_lib } "]
5253 TOML
5354
55+ ( buildpath /"Modules/pyproject.toml" ) . append_lines <<~TOML if OS . linux?
56+ [[tool.setuptools.ext-modules]]
57+ name = "_dbm"
58+ sources = ["_dbmmodule.c"]
59+ include-dirs = ["#{ Formula [ "gdbm" ] . opt_include } ", "#{ python_include } /internal"]
60+ libraries = ["gdbm_compat"]
61+ library-dirs = ["#{ Formula [ "gdbm" ] . opt_lib } "]
62+ extra-compile-args = ["-DUSE_GDBM_COMPAT", "-DHAVE_GDBM_DASH_NDBM_H"]
63+ TOML
64+
5465 system python3 , "-m" , "pip" , "install" , *std_pip_args ( prefix : false , build_isolation : true ) ,
5566 "--target=#{ libexec } " , "./Modules"
5667 rm_r libexec . glob ( "*.dist-info" )
@@ -67,5 +78,19 @@ def install
6778 with dbm.gnu.open("#{ testdb } ", "r") as db:
6879 assert db["testkey"] == b"testvalue"
6980 PYTHON
81+
82+ return unless OS . linux?
83+
84+ ( testpath /"dbm_test.py" ) . write <<~PYTHON
85+ import dbm
86+
87+ with dbm.ndbm.open("test", "c") as db:
88+ db[b"foo \\ xbd"] = b"bar \\ xbd"
89+ with dbm.ndbm.open("test", "r") as db:
90+ assert list(db.keys()) == [b"foo \\ xbd"]
91+ assert b"foo \\ xbd" in db
92+ assert db[b"foo \\ xbd"] == b"bar \\ xbd"
93+ PYTHON
94+ system python3 , "dbm_test.py"
7095 end
7196end
0 commit comments