commit:     d66618100ede704ce4371fbe1fd031723869e022
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 12:12:03 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 12:13:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6661810

dev-python/oslo-i18n: enable py3.11

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 .../files/oslo-i18n-5.1.0-fix-py3.11.patch         | 22 ++++++++++++++++++++++
 .../files/oslo-i18n-5.1.0-fix-py3.11.patch.bck     | 14 ++++++++++++++
 dev-python/oslo-i18n/oslo-i18n-5.1.0-r1.ebuild     |  6 +++++-
 3 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch 
b/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch
new file mode 100644
index 000000000000..488dac1dedc6
--- /dev/null
+++ b/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch
@@ -0,0 +1,22 @@
+diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py
+index 85dbd67..16492bb 100644
+--- a/oslo_i18n/tests/test_message.py
++++ b/oslo_i18n/tests/test_message.py
+@@ -386,7 +386,7 @@ class MessageTestCase(test_base.BaseTestCase):
+ 
+             self.assertEqual(default_translation, msg.translation('es'))
+ 
+-            self.assertEqual(1, len(w))
++            self.assertLessEqual(1, len(w))
+             # Note(gibi): in python 3.4 str.__repr__ does not put the unicode
+             # marker 'u' in front of the string representations so the test
+             # removes that to have the same result in python 2.7 and 3.4
+@@ -394,7 +394,7 @@ class MessageTestCase(test_base.BaseTestCase):
+                              "translated message A message in Spanish: %s %s "
+                              "(Original: 'A message: %s'): "
+                              "not enough arguments for format string",
+-                             str(w[0].message).replace("u'", "'"))
++                             str(w[-1].message).replace("u'", "'"))
+ 
+         mock_log.debug.assert_called_with(('Failed to insert replacement '
+                                            'values into translated message '

diff --git a/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch.bck 
b/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch.bck
new file mode 100644
index 000000000000..2faae7eb88af
--- /dev/null
+++ b/dev-python/oslo-i18n/files/oslo-i18n-5.1.0-fix-py3.11.patch.bck
@@ -0,0 +1,14 @@
+On python 3.11, we have some more warnings (deprecation warnings),
+so the count is >=1
+
+--- a/oslo_i18n/tests/test_message.py
++++ b/oslo_i18n/tests/test_message.py
+@@ -386,7 +386,7 @@ class MessageTestCase(test_base.BaseTestCase):
+
+             self.assertEqual(default_translation, msg.translation('es'))
+
+-            self.assertEqual(1, len(w))
++            self.assertLessEqual(1, len(w))
+             # Note(gibi): in python 3.4 str.__repr__ does not put the unicode
+             # marker 'u' in front of the string representations so the test
+             # removes that to have the same result in python 2.7 and 3.4

diff --git a/dev-python/oslo-i18n/oslo-i18n-5.1.0-r1.ebuild 
b/dev-python/oslo-i18n/oslo-i18n-5.1.0-r1.ebuild
index 7053c73f76d7..0dd4662cf5a3 100644
--- a/dev-python/oslo-i18n/oslo-i18n-5.1.0-r1.ebuild
+++ b/dev-python/oslo-i18n/oslo-i18n-5.1.0-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 
 inherit distutils-r1
 
@@ -24,6 +24,10 @@ LICENSE="Apache-2.0"
 SLOT="0"
 KEYWORDS="amd64 ~arm arm64 ~riscv x86"
 
+PATCHES=(
+       "${FILESDIR}/${PN}-5.1.0-fix-py3.11.patch"
+)
+
 RDEPEND="
        >=dev-python/pbr-2.0.0[${PYTHON_USEDEP}]
 "

Reply via email to