[packages/python-pycryptodomex] - disable gmp on x32, now tests pass

qboosh qboosh at pld-linux.org
Mon Jan 26 15:43:11 CET 2026


commit 1a2dcb4161d5aec898dd8aecd32cb9aa4345ebc8
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Jan 26 15:43:15 2026 +0100

    - disable gmp on x32, now tests pass

 pycryptodomex-disable-gmp.patch | 22 ++++++++++++++++++++++
 python-pycryptodomex.spec       |  7 ++++++-
 x32.patch                       |  9 +++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)
---
diff --git a/python-pycryptodomex.spec b/python-pycryptodomex.spec
index 62e891c..548df5e 100644
--- a/python-pycryptodomex.spec
+++ b/python-pycryptodomex.spec
@@ -15,6 +15,7 @@ Group:		Libraries/Python
 Source0:	https://files.pythonhosted.org/packages/source/p/pycryptodomex/%{module}-%{version}.tar.gz
 # Source0-md5:	c54ba32585587dd47087a8cf8032d72b
 Patch0:		x32.patch
+Patch1:		pycryptodomex-disable-gmp.patch
 URL:		https://www.pycryptodome.org/
 %if %{with python2}
 BuildRequires:	python-devel >= 1:2.7
@@ -159,7 +160,11 @@ Dokumentacja API modułu Pythona %{module}.
 
 %prep
 %setup -q -n %{module}-%{version}
-%patch -P 0 -p1
+%patch -P0 -p1
+%ifarch x32
+# GMP seems to have some functions broken on x32
+%patch -P1 -p1
+%endif
 
 # adjust for pycryptodomex
 %{__sed} -i -e 's,Crypto\.Util,Cryptodome.Util,' \
diff --git a/pycryptodomex-disable-gmp.patch b/pycryptodomex-disable-gmp.patch
new file mode 100644
index 0000000..021c5db
--- /dev/null
+++ b/pycryptodomex-disable-gmp.patch
@@ -0,0 +1,22 @@
+--- pycryptodomex-3.23.0/lib/Cryptodome/Math/Numbers.py.orig	2025-05-17 16:51:52.000000000 +0200
++++ pycryptodomex-3.23.0/lib/Cryptodome/Math/Numbers.py	2026-01-26 15:33:32.222013634 +0100
+@@ -33,7 +33,7 @@ __all__ = ["Integer"]
+ import os
+ 
+ try:
+-    if os.getenv("PYCRYPTODOME_DISABLE_GMP"):
++    if True:
+         raise ImportError()
+ 
+     from Cryptodome.Math._IntegerGMP import IntegerGMP as Integer
+--- pycryptodomex-3.23.0/lib/Cryptodome/SelfTest/Math/test_Numbers.py.orig	2026-01-26 15:34:29.935661207 +0100
++++ pycryptodomex-3.23.0/lib/Cryptodome/SelfTest/Math/test_Numbers.py	2026-01-26 15:34:32.612342448 +0100
+@@ -806,7 +806,7 @@ def get_tests(config={}):
+     tests += list_test_cases(TestIntegerInt)
+ 
+     try:
+-        from Cryptodome.Math._IntegerGMP import IntegerGMP
++        from Cryptodome.Math._IntegerGMPDisabled import IntegerGMP
+ 
+         class TestIntegerGMP(TestIntegerBase):
+             def setUp(self):
diff --git a/x32.patch b/x32.patch
index ac564ee..240228b 100644
--- a/x32.patch
+++ b/x32.patch
@@ -9,6 +9,15 @@
     #define ENDIAN_LITTLE
     #define ENDIAN_32BITWORD
     #define LTC_FAST
+@@ -70,7 +70,7 @@ LTC_EXPORT int   LTC_CALL XSTRCMP(const
+ #endif
+ 
+ /* detect amd64 */
+-#if !defined(__STRICT_ANSI__) && defined(__x86_64__)
++#if !defined(__STRICT_ANSI__) && (defined(__x86_64__) && !defined(__ILP32__))
+    #define ENDIAN_LITTLE
+    #define ENDIAN_64BITWORD
+    #define LTC_FAST
 --- pycryptodomex-3.21.0/src/libtom/tomcrypt_macros.h~	2024-10-01 20:38:19.000000000 +0200
 +++ pycryptodomex-3.21.0/src/libtom/tomcrypt_macros.h	2025-03-15 20:17:39.763318304 +0100
 @@ -10,7 +10,7 @@
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pycryptodomex.git/commitdiff/1a2dcb4161d5aec898dd8aecd32cb9aa4345ebc8



More information about the pld-cvs-commit mailing list