guix_mirror_bot pushed a commit to branch master
in repository guix.

commit d463b29e4d4116456d45c424e6670d1faa38b686
Author: Nicolas Graves <[email protected]>
AuthorDate: Tue Dec 9 22:29:09 2025 +0100

    gnu: python-pycryptodome: Update to 3.23.0.
    
    * gnu/packages/python-crypto.scm (python-pycryptodome): Update to 3.23.0.
    [source]: Switch to git-fetch.
    [build-system]: Switch to pyproject-build-system.
    [arguments]<#:test-backend, #:test-flags>: Use custom.
    <#:phases>: Add 'patch-gmp-path phase.
    [inputs]: Add gmp.
    [native-inputs]: Add python-pycryptodome-test-vectors, python-setuptools.
    (python-pycryptodomex): Switch to package/inherit and build from the
    same source as python-pycryptodome.
    [arguments] <#:test-flags>: Adjust for python-pycryptodomex as seen in
    INSTALL.rst.
    <#:phases>: Add 'set-separate-namespace.
    [synopsis]: Mention the difference as seen in README.md.
    
    Change-Id: Ic19ee6627c1b95e79980add893a8f4678feae317
    Modified-by: Sharlatan Hellseher <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/python-crypto.scm | 61 ++++++++++++++++++++++++++++++------------
 1 file changed, 44 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index 5e4f2f9aab..412382638a 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -971,19 +971,42 @@ Python.")
 (define-public python-pycryptodome
   (package
     (name "python-pycryptodome")
-    (version "3.21.0")
+    (version "3.23.0")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "pycryptodome" version))
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://github.com/Legrandin/pycryptodome";)
+              (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
-        (base32
-         "15vjyjy686kgm4fnpwlah1wvxxy0wvr4q5vnp1iygnlv8q6pwy7p"))
+        (base32 "0j1dk55y0q7gqmig1l5b8774w63w2i7qrii1xzkpzz0c3i229i67"))
        (modules '((guix build utils)))
        (snippet pycryptodome-unbundle-tomcrypt-snippet)))
-    (build-system python-build-system)
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      ;; tests: 42912 passed
+      #:test-backend #~'custom
+      ;; As seen in
+      ;; <https://github.com/Legrandin/pycryptodome/blob/v3.23.0/INSTALL.rst>.
+      #:test-flags
+      #~(list "-m" "Crypto.SelfTest")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'patch-gmp-path
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "lib/Crypto/Math/_IntegerGMP.py"
+                (("load_lib\\(\"gmp\"")
+                 (format #f "load_lib(~s"
+                         (search-input-file inputs "/lib/libgmp.so.10")))))))))
+    (native-inputs
+     (list python-pycryptodome-test-vectors
+           python-setuptools))
     (inputs
-     (list libtomcrypt libtommath))
+     (list gmp
+           libtomcrypt
+           libtommath))
     (home-page "https://www.pycryptodome.org";)
     (synopsis "Low-level cryptographic Python library")
     (description
@@ -1047,17 +1070,21 @@ PyCryptodome variants, the other being 
python-pycryptodomex.")
                    license:asl2.0))))
 
 (define-public python-pycryptodomex
-  (package (inherit python-pycryptodome)
+  (package/inherit python-pycryptodome
     (name "python-pycryptodomex")
-    (version (package-version python-pycryptodome))
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "pycryptodomex" version))
-       (sha256
-        (base32 "0v4y03ha7rm9kdcv9fkrmc94425z3q3mq1nn5p1jbpc1ag80nb92"))
-       (modules '((guix build utils)))
-       (snippet pycryptodome-unbundle-tomcrypt-snippet)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-pycryptodome)
+       ((#:test-flags _)
+        #~(list "-m" "Cryptodome.SelfTest"))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-before 'build 'set-separate-namespace
+              (lambda _
+                ;; This changes the build logic, see setup.py.
+                (with-output-to-file ".separate_namespace"
+                  (lambda _ (display "")))))))))
+    (synopsis
+     "Low-level cryptographic Python library independent of the old PyCrypto")
     (description
      "PyCryptodome is a self-contained Python package of low-level
 cryptographic primitives.  It's not a wrapper to a separate C library like

Reply via email to