Subject: [PATCH 1/3] gnu: Add python-berkeleydb.

From: Arun Isaac <[email-masked]>
Date: Thu, 9 Sep 2021 01:12:09 +0530

* gnu/packages/python-xyz.scm (python-berkeleydb): New variable.
---
 gnu/packages/python-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 7c70829de9..a7020b7615 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -26556,3 +26556,44 @@ files and directories and adds a datestamp in standard ISO 8601+ format
 YYYY-MM-DD at the beginning of the file or directory name.")
       (home-page "https://github.com/novoid/date2name")
       (license license:gpl3+))))
+
+(define-public python-berkeleydb
+  (package
+    (name "python-berkeleydb")
+    (version "18.1.4")
+    (source
+     (origin
+       ;; We use the upstream repository, as the tests are not included in the
+       ;; PyPI releases.
+       (method hg-fetch)
+       (uri (hg-reference
+             (url "https://hg.jcea.es/pybsddb/")
+             (changeset version)))
+       (file-name (string-append name "-" version "-checkout"))
+       (sha256
+        (base32
+         "0xj0l73ns6xph5pmysna7g4rdla1alvh2s2k2crhwv8yghjmnjqi"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'unpack 'suppress-license-warning
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "BERKELEYDB_DIR" (assoc-ref inputs "bdb"))
+             (setenv "YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION" "1")))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "./test.py" "-v")))))))
+    (inputs
+     `(("bdb" ,bdb)))
+    (home-page "https://www.jcea.es/programacion/pybsddb.htm")
+    (synopsis "Python bindings for Oracle Berkeley DB")
+    (description "This package provides a nearly complete wrapping of the
+Oracle/Sleepycat C API for the Database Environment, Database, Cursor, Log
+Cursor, Sequence and Transaction objects, and each of these is exposed as a
+Python type in the berkeleydb.db module.  The database objects can use various
+access methods: btree, hash, recno, queue and heap.  Oracle Berkeley DB
+distributed transactions, Oracle Berkeley DB Replication Manager and Oracle
+Berkeley DB Base Replication are supported.")
+    (license license:bsd-3)))
-- 
2.33.0