commit:     ed8546f3c2fde853395080fc346968f6d6019d63
Author:     Christopher Byrne <salah.coronya <AT> gmail <DOT> com>
AuthorDate: Thu Aug 10 00:40:25 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct  1 07:15:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ed8546f3

dev-python/tpm2-pytss: Fix failing test, add DISTUTILS_EXT

Closes: https://bugs.gentoo.org/911838
Signed-off-by: Christopher Byrne <salah.coronya <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...-add-check-for-renamed-cryptography-types.patch | 45 ++++++++++++++++++++++
 dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild   | 44 +++++++++++++++++++++
 2 files changed, 89 insertions(+)

diff --git 
a/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
 
b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
new file mode 100644
index 000000000000..c1aeaee4dcd1
--- /dev/null
+++ 
b/dev-python/tpm2-pytss/files/tpm2-pytss-2.1.0-test-add-check-for-renamed-cryptography-types.patch
@@ -0,0 +1,45 @@
+From e4006e6066c015d9ed55befa9b98247fbdcafd7d Mon Sep 17 00:00:00 2001
+From: Erik Larsson <[email protected]>
+Date: Mon, 26 Jun 2023 12:15:41 +0200
+Subject: [PATCH] test: add check for renamed cryptography types
+
+Some types have changed their names in newer cryptography release, so add them 
to the tests
+
+Signed-off-by: Erik Larsson <[email protected]>
+---
+ test/test_crypto.py | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/test/test_crypto.py b/test/test_crypto.py
+index 92cda00..7d7466e 100644
+--- a/test/test_crypto.py
++++ b/test/test_crypto.py
+@@ -596,11 +596,23 @@ class CryptoTest(TSS2_EsapiTest):
+ 
+         with self.assertRaises(ValueError) as e:
+             TPMT_SENSITIVE.from_pem(der)
+-        self.assertEqual(str(e.exception), "unsupported key type: 
_DSAPrivateKey")
++        self.assertIn(
++            str(e.exception),
++            (
++                "unsupported key type: _DSAPrivateKey",
++                "unsupported key type: DSAPrivateKey",
++            ),
++        )
+ 
+         with self.assertRaises(ValueError) as e:
+             TPMT_PUBLIC.from_pem(dsa_public_key)
+-        self.assertEqual(str(e.exception), "unsupported key type: 
_DSAPublicKey")
++        self.assertIn(
++            str(e.exception),
++            (
++                "unsupported key type: _DSAPublicKey",
++                "unsupported key type: DSAPublicKey",
++            ),
++        )
+ 
+     def test_from_pem_with_symmetric(self):
+         sym = TPMT_SYM_DEF_OBJECT(algorithm=TPM2_ALG.AES)
+-- 
+2.41.0
+

diff --git a/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild 
b/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild
new file mode 100644
index 000000000000..18d96bdbc4e2
--- /dev/null
+++ b/dev-python/tpm2-pytss/tpm2-pytss-2.1.0-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYPI_NO_NORMALIZE=1
+PYTHON_COMPAT=( python3_{10..11} )
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Python bindings for TSS"
+HOMEPAGE="
+       https://pypi.org/project/tpm2-pytss
+       https://github.com/tpm2-software/tpm2-pytss
+"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="+fapi test"
+
+RDEPEND="app-crypt/tpm2-tss:=[fapi=]
+       fapi? ( >=app-crypt/tpm2-tss-3.0.3:= )
+       dev-python/cffi[${PYTHON_USEDEP}]
+       dev-python/asn1crypto[${PYTHON_USEDEP}]
+       dev-python/cryptography[${PYTHON_USEDEP}]
+       dev-python/pycparser[${PYTHON_USEDEP}]
+       dev-python/pyyaml[${PYTHON_USEDEP}]"
+
+DEPEND="${RDEPEND}
+       test? ( app-crypt/swtpm )"
+
+BDEPEND="dev-python/setuptools-scm[${PYTHON_USEDEP}]
+       dev-python/pkgconfig[${PYTHON_USEDEP}]"
+
+PATCHES=(
+       
"${FILESDIR}/${PN}-2.1.0-test-add-check-for-renamed-cryptography-types.patch"
+       )
+
+export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
+
+distutils_enable_tests pytest

Reply via email to