commit:     2acb2e9a2b53726945e74c0e64f082291217230f
Author:     Horea Christian <chr <AT> chymera <DOT> eu>
AuthorDate: Sun Mar 27 04:14:20 2022 +0000
Commit:     Horea Christian <horea.christ <AT> gmail <DOT> com>
CommitDate: Sun Mar 27 04:14:20 2022 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=2acb2e9a

dev-python/pycryptodomex: new package (DANDI stack)

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Horea Christian <chr <AT> chymera.eu>

 .../pycryptodome-3.10.1-system-libtomcrypt.patch   | 50 ++++++++++++++++++++++
 dev-python/pycryptodomex/metadata.xml              | 21 +++++++++
 .../pycryptodomex/pycryptodomex-3.10.4.ebuild      | 43 +++++++++++++++++++
 .../pycryptodomex/pycryptodomex-3.14.1.ebuild      | 43 +++++++++++++++++++
 4 files changed, 157 insertions(+)

diff --git 
a/dev-python/pycryptodomex/files/pycryptodome-3.10.1-system-libtomcrypt.patch 
b/dev-python/pycryptodomex/files/pycryptodome-3.10.1-system-libtomcrypt.patch
new file mode 100644
index 000000000..51a5766c1
--- /dev/null
+++ 
b/dev-python/pycryptodomex/files/pycryptodome-3.10.1-system-libtomcrypt.patch
@@ -0,0 +1,50 @@
+diff -dupr a/setup.py b/setup.py
+--- a/setup.py 2021-02-09 13:49:46.356455141 +0100
++++ b/setup.py 2021-02-09 13:50:49.351076275 +0100
+@@ -367,13 +367,15 @@ ext_modules = [
+         sources=["src/CAST.c"],
+         py_limited_api=True),
+     Extension("Crypto.Cipher._raw_des",
+-        include_dirs=['src/', 'src/libtom/'],
++        include_dirs=['src/'],
+         sources=["src/DES.c"],
+-        py_limited_api=True),
++        py_limited_api=True,
++        extra_link_args=["-ltomcrypt"]),
+     Extension("Crypto.Cipher._raw_des3",
+-        include_dirs=['src/', 'src/libtom/'],
++        include_dirs=['src/'],
+         sources=["src/DES3.c"],
+-        py_limited_api=True),
++        py_limited_api=True,
++        extra_link_args=["-ltomcrypt"]),
+     Extension("Crypto.Util._cpuid_c",
+         include_dirs=['src/'],
+         sources=['src/cpuid.c'],
+@@ -410,9 +412,10 @@ ext_modules = [
+         sources=["src/ARC4.c"],
+         py_limited_api=True),
+     Extension("Crypto.Cipher._Salsa20",
+-        include_dirs=['src/', 'src/libtom/'],
++        include_dirs=['src/'],
+         sources=["src/Salsa20.c"],
+-        py_limited_api=True),
++        py_limited_api=True,
++        extra_link_args=["-ltomcrypt"]),
+     Extension("Crypto.Cipher._chacha20",
+         include_dirs=['src/'],
+         sources=["src/chacha20.c"],
+Only in b: setup.py.orig
+Only in b: setup.py.rej
+diff -dupr a/src/DES.c b/src/DES.c
+--- a/src/DES.c        2021-02-09 13:49:46.336454729 +0100
++++ b/src/DES.c        2021-02-09 13:50:02.640123617 +0100
+@@ -39,7 +39,7 @@ FAKE_INIT(raw_des3)
+ 
+ /* Include the actial DES implementation */
+ #define LTC_NO_PROTOTYPES
+-#include "libtom/tomcrypt_des.c"
++#include <tomcrypt.h>
+ 
+ struct block_state {
+     symmetric_key sk;

diff --git a/dev-python/pycryptodomex/metadata.xml 
b/dev-python/pycryptodomex/metadata.xml
new file mode 100644
index 000000000..f9c82e80b
--- /dev/null
+++ b/dev-python/pycryptodomex/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Horea Christian</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>[email protected]</email>
+               <name>Gentoo Science Project</name>
+       </maintainer>
+       <longdescription lang="en">
+               Equivalent package to dev-python/cryptodome which installs
+               modules under the Cryptodome package, so that PyCrypto and
+               PyCryptodome can coexist.
+       </longdescription>
+       <upstream>
+               <remote-id type="github">Legrandin/pycryptodome</remote-id>
+               <remote-id type="pypi">pycryptodomex</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-python/pycryptodomex/pycryptodomex-3.10.4.ebuild 
b/dev-python/pycryptodomex/pycryptodomex-3.10.4.ebuild
new file mode 100644
index 000000000..0f5ad73c2
--- /dev/null
+++ b/dev-python/pycryptodomex/pycryptodomex-3.10.4.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..10} pypy3)
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Cryptographic library for Python"
+HOMEPAGE="https://www.pycryptodome.org https://pypi.org/project/pycryptodomex/";
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD-2 Unlicense"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       dev-libs/gmp:0=
+       >=dev-libs/libtomcrypt-1.18.2-r1:=
+"
+BDEPEND="virtual/python-cffi[${PYTHON_USEDEP}]"
+RDEPEND="
+       ${DEPEND}
+       ${BDEPEND}
+"
+
+PATCHES=(
+       "${FILESDIR}/pycryptodome-3.10.1-system-libtomcrypt.patch"
+)
+
+distutils_enable_tests setup.py
+
+python_prepare_all() {
+       # make sure we're unbundling it correctly
+       rm -r src/libtom || die
+
+       distutils-r1_python_prepare_all
+}

diff --git a/dev-python/pycryptodomex/pycryptodomex-3.14.1.ebuild 
b/dev-python/pycryptodomex/pycryptodomex-3.14.1.ebuild
new file mode 100644
index 000000000..0f5ad73c2
--- /dev/null
+++ b/dev-python/pycryptodomex/pycryptodomex-3.14.1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{8..10} pypy3)
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Cryptographic library for Python"
+HOMEPAGE="https://www.pycryptodome.org https://pypi.org/project/pycryptodomex/";
+SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="BSD-2 Unlicense"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+       dev-libs/gmp:0=
+       >=dev-libs/libtomcrypt-1.18.2-r1:=
+"
+BDEPEND="virtual/python-cffi[${PYTHON_USEDEP}]"
+RDEPEND="
+       ${DEPEND}
+       ${BDEPEND}
+"
+
+PATCHES=(
+       "${FILESDIR}/pycryptodome-3.10.1-system-libtomcrypt.patch"
+)
+
+distutils_enable_tests setup.py
+
+python_prepare_all() {
+       # make sure we're unbundling it correctly
+       rm -r src/libtom || die
+
+       distutils-r1_python_prepare_all
+}

Reply via email to