Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pycryptodome/, dev-python/pycryptodome/files/
Date: Tue, 09 Feb 2021 13:14:02
Message-Id: 1612876434.29ad384fc17a0c9efe52d1d6283aee3d268ce5e2.mgorny@gentoo
1 commit: 29ad384fc17a0c9efe52d1d6283aee3d268ce5e2
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 9 12:53:33 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 9 13:13:54 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29ad384f
7
8 dev-python/pycryptodome: Bump to 3.10.1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pycryptodome/Manifest | 1 +
13 .../files/pycryptodome-3.10.1-parallel-make.patch | 22 +++++++++
14 .../pycryptodome-3.10.1-system-libtomcrypt.patch | 50 ++++++++++++++++++++
15 dev-python/pycryptodome/pycryptodome-3.10.1.ebuild | 54 ++++++++++++++++++++++
16 4 files changed, 127 insertions(+)
17
18 diff --git a/dev-python/pycryptodome/Manifest b/dev-python/pycryptodome/Manifest
19 index 5c3a1ea1a6e..4ac5d971007 100644
20 --- a/dev-python/pycryptodome/Manifest
21 +++ b/dev-python/pycryptodome/Manifest
22 @@ -1 +1,2 @@
23 +DIST pycryptodome-3.10.1.tar.gz 15545471 BLAKE2B ef1922efd0b6bef6beaee76fe03a4201a6f1cf2a203abcb12b96a5ea7c8de59a34ac704fe7508a3728a214efc0755f289d66dc14a0adb3f2eac882bc8db691bf SHA512 4c7e7e989d5363064e7e184f6b00a174045e03916cdf1199626afd7fe75eb5efcd13888ecdee607b974e96faad465694b384eb6d91edb8de1d0277ad71888c52
24 DIST pycryptodome-3.9.9.tar.gz 15551299 BLAKE2B ac89bcc2bbe707cb2a9cf2496a2eb74ff5685f11017d60d67558de7ac6cad5c24c43b4074bff01e99378d7c88462e88e88f363c5329fb800e1a7872ad8a34dab SHA512 a1aad4d52256220fe3d5d7f399c2c5e7338d6eb88058da0571fe1c686d74d33ff4bc1c275d4b9373e0ff22f4ddcded75a25387e76fc65047f8612f8856c1bd4d
25
26 diff --git a/dev-python/pycryptodome/files/pycryptodome-3.10.1-parallel-make.patch b/dev-python/pycryptodome/files/pycryptodome-3.10.1-parallel-make.patch
27 new file mode 100644
28 index 00000000000..3b8f503bb29
29 --- /dev/null
30 +++ b/dev-python/pycryptodome/files/pycryptodome-3.10.1-parallel-make.patch
31 @@ -0,0 +1,22 @@
32 +diff -dupr a/setup.py b/setup.py
33 +--- a/setup.py 2021-02-09 13:46:16.138626317 +0100
34 ++++ b/setup.py 2021-02-09 13:46:51.116065599 +0100
35 +@@ -360,7 +360,7 @@ ext_modules = [
36 + Extension("Crypto.Cipher._raw_eksblowfish",
37 + include_dirs=['src/'],
38 + define_macros=[('EKS',None),],
39 +- sources=["src/blowfish.c"],
40 ++ sources=["src/blowfish_eks.c"],
41 + py_limited_api=True),
42 + Extension("Crypto.Cipher._raw_cast",
43 + include_dirs=['src/'],
44 +@@ -442,7 +442,8 @@ ext_modules = [
45 + # Math
46 + Extension("Crypto.Math._modexp",
47 + include_dirs=['src/'],
48 +- sources=['src/modexp.c', 'src/siphash.c', 'src/modexp_utils.c', 'src/mont.c'],
49 ++ sources=['src/modexp.c', 'src/siphash.c', 'src/modexp_utils.c',
50 ++ 'src/mont_math.c'],
51 + py_limited_api=True,
52 + ),
53 + ]
54
55 diff --git a/dev-python/pycryptodome/files/pycryptodome-3.10.1-system-libtomcrypt.patch b/dev-python/pycryptodome/files/pycryptodome-3.10.1-system-libtomcrypt.patch
56 new file mode 100644
57 index 00000000000..51a5766c15f
58 --- /dev/null
59 +++ b/dev-python/pycryptodome/files/pycryptodome-3.10.1-system-libtomcrypt.patch
60 @@ -0,0 +1,50 @@
61 +diff -dupr a/setup.py b/setup.py
62 +--- a/setup.py 2021-02-09 13:49:46.356455141 +0100
63 ++++ b/setup.py 2021-02-09 13:50:49.351076275 +0100
64 +@@ -367,13 +367,15 @@ ext_modules = [
65 + sources=["src/CAST.c"],
66 + py_limited_api=True),
67 + Extension("Crypto.Cipher._raw_des",
68 +- include_dirs=['src/', 'src/libtom/'],
69 ++ include_dirs=['src/'],
70 + sources=["src/DES.c"],
71 +- py_limited_api=True),
72 ++ py_limited_api=True,
73 ++ extra_link_args=["-ltomcrypt"]),
74 + Extension("Crypto.Cipher._raw_des3",
75 +- include_dirs=['src/', 'src/libtom/'],
76 ++ include_dirs=['src/'],
77 + sources=["src/DES3.c"],
78 +- py_limited_api=True),
79 ++ py_limited_api=True,
80 ++ extra_link_args=["-ltomcrypt"]),
81 + Extension("Crypto.Util._cpuid_c",
82 + include_dirs=['src/'],
83 + sources=['src/cpuid.c'],
84 +@@ -410,9 +412,10 @@ ext_modules = [
85 + sources=["src/ARC4.c"],
86 + py_limited_api=True),
87 + Extension("Crypto.Cipher._Salsa20",
88 +- include_dirs=['src/', 'src/libtom/'],
89 ++ include_dirs=['src/'],
90 + sources=["src/Salsa20.c"],
91 +- py_limited_api=True),
92 ++ py_limited_api=True,
93 ++ extra_link_args=["-ltomcrypt"]),
94 + Extension("Crypto.Cipher._chacha20",
95 + include_dirs=['src/'],
96 + sources=["src/chacha20.c"],
97 +Only in b: setup.py.orig
98 +Only in b: setup.py.rej
99 +diff -dupr a/src/DES.c b/src/DES.c
100 +--- a/src/DES.c 2021-02-09 13:49:46.336454729 +0100
101 ++++ b/src/DES.c 2021-02-09 13:50:02.640123617 +0100
102 +@@ -39,7 +39,7 @@ FAKE_INIT(raw_des3)
103 +
104 + /* Include the actial DES implementation */
105 + #define LTC_NO_PROTOTYPES
106 +-#include "libtom/tomcrypt_des.c"
107 ++#include <tomcrypt.h>
108 +
109 + struct block_state {
110 + symmetric_key sk;
111
112 diff --git a/dev-python/pycryptodome/pycryptodome-3.10.1.ebuild b/dev-python/pycryptodome/pycryptodome-3.10.1.ebuild
113 new file mode 100644
114 index 00000000000..2e000e816ee
115 --- /dev/null
116 +++ b/dev-python/pycryptodome/pycryptodome-3.10.1.ebuild
117 @@ -0,0 +1,54 @@
118 +# Copyright 1999-2021 Gentoo Authors
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=7
122 +
123 +PYTHON_COMPAT=( python3_{7..9} pypy3 )
124 +PYTHON_REQ_USE="threads(+)"
125 +
126 +inherit distutils-r1
127 +
128 +DESCRIPTION="A self-contained cryptographic library for Python"
129 +HOMEPAGE="https://www.pycryptodome.org/
130 + https://github.com/Legrandin/pycryptodome/
131 + https://pypi.org/project/pycryptodome/"
132 +SRC_URI="
133 + https://github.com/Legrandin/pycryptodome/archive/v${PV}.tar.gz
134 + -> ${P}.tar.gz"
135 +
136 +LICENSE="BSD-2 Unlicense"
137 +SLOT="0"
138 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x64-macos"
139 +IUSE=""
140 +
141 +DEPEND="
142 + dev-libs/gmp:0=
143 + >=dev-libs/libtomcrypt-1.18.2-r1:="
144 +BDEPEND="
145 + virtual/python-cffi[${PYTHON_USEDEP}]"
146 +RDEPEND="
147 + ${DEPEND}
148 + ${BDEPEND}
149 + !dev-python/pycrypto"
150 +
151 +PATCHES=(
152 + "${FILESDIR}/pycryptodome-3.10.1-parallel-make.patch"
153 + "${FILESDIR}/pycryptodome-3.10.1-system-libtomcrypt.patch"
154 +)
155 +
156 +distutils_enable_tests setup.py
157 +
158 +python_prepare_all() {
159 + # parallel make fixes
160 + # Multiple targets were compiling the same file, setuptools doesn't
161 + # understand this and you get race conditions where a file gets
162 + # overwritten while it's linking. This makes the files look like separate
163 + # files so this race won't happen
164 + ln src/blowfish.c src/blowfish_eks.c || die
165 + ln src/mont.c src/mont_math.c || die
166 +
167 + # make sure we're unbundling it correctly
168 + rm -r src/libtom || die
169 +
170 + distutils-r1_python_prepare_all
171 +}