summaryrefslogtreecommitdiff
path: root/dev-python
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2025-03-18 19:45:58 +0100
committerMichał Górny <mgorny@gentoo.org>2025-03-18 20:30:23 +0100
commitca6a01fe9f8a05c7994d9eb2eeafc0f0ab2eb6e3 (patch)
tree7496460f70821e4ec2a34ec1e786c6980ffb77dd /dev-python
parent7d3c82a100d7f1b86c9c448eb381643d1c42e01d (diff)
downloadgentoo-ca6a01fe9f8a05c7994d9eb2eeafc0f0ab2eb6e3.tar.gz
gentoo-ca6a01fe9f8a05c7994d9eb2eeafc0f0ab2eb6e3.tar.bz2
gentoo-ca6a01fe9f8a05c7994d9eb2eeafc0f0ab2eb6e3.zip
dev-python/absl-py: Enable py3.13
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/absl-py/absl-py-2.1.0.ebuild24
-rw-r--r--dev-python/absl-py/files/absl-py-2.1.0-py313.patch60
2 files changed, 77 insertions, 7 deletions
diff --git a/dev-python/absl-py/absl-py-2.1.0.ebuild b/dev-python/absl-py/absl-py-2.1.0.ebuild
index 93edca72b17f..eb498851db10 100644
--- a/dev-python/absl-py/absl-py-2.1.0.ebuild
+++ b/dev-python/absl-py/absl-py-2.1.0.ebuild
@@ -1,10 +1,10 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{10..12} )
+PYTHON_COMPAT=( python3_{10..13} )
inherit distutils-r1
@@ -29,6 +29,13 @@ RDEPEND="
"
src_prepare() {
+ local PATCHES=(
+ # https://github.com/abseil/abseil-py/commit/78fb38cea7ffd1329f6455c997302529ce6fc6ce
+ "${FILESDIR}/${P}-py313.patch"
+ )
+
+ distutils-r1_src_prepare
+
# what a nightmare... well, we could have called bazel but that would
# even worse
local helpers=(
@@ -55,12 +62,15 @@ src_prepare() {
done
# i don't wanna know how these pass for upstream with wrong helper names
- sed -i -e 's:\(app_test_helper\)\.py:\1_pure_python:' \
- absl/tests/app_test.py || die
- sed -i -e 's:\(logging_functional_test_helper\)\.py:\1:' \
- absl/logging/tests/logging_functional_test.py || die
+ sed -e 's:\(app_test_helper\)\.py:\1_pure_python:' \
+ -i absl/tests/app_test.py || die
+ sed -e 's:\(logging_functional_test_helper\)\.py:\1:' \
+ -i absl/logging/tests/logging_functional_test.py || die
- distutils-r1_src_prepare
+ # parts of 617ce2c8b9976aa9e32c079c625fa6d864b2bbee
+ # (don't sed the one case containing ", suiteClass=...")
+ sed -e 's:unittest\.makeSuite\(([^,]*)\):unittest.defaultTestLoader.loadTestsFromTestCase\1:' \
+ -i absl/testing/tests/{absltest,parameterized}_test.py || die
}
python_test() {
diff --git a/dev-python/absl-py/files/absl-py-2.1.0-py313.patch b/dev-python/absl-py/files/absl-py-2.1.0-py313.patch
new file mode 100644
index 000000000000..81406734980c
--- /dev/null
+++ b/dev-python/absl-py/files/absl-py-2.1.0-py313.patch
@@ -0,0 +1,60 @@
+From 78fb38cea7ffd1329f6455c997302529ce6fc6ce Mon Sep 17 00:00:00 2001
+From: Oleh Prypin <oprypin@google.com>
+Date: Wed, 11 Dec 2024 04:19:00 -0800
+Subject: [PATCH] Declare support for Python 3.13
+
+PiperOrigin-RevId: 705056014
+
+diff --git a/absl/flags/tests/argparse_flags_test.py b/absl/flags/tests/argparse_flags_test.py
+index 679a1cce..cfc364f0 100644
+--- a/absl/flags/tests/argparse_flags_test.py
++++ b/absl/flags/tests/argparse_flags_test.py
+@@ -227,7 +227,10 @@ def test_help_main_module_flags(self):
+ # Only the short name is shown in the usage string.
+ self.assertIn('[-s ABSL_STRING]', help_message)
+ # Both names are included in the options section.
+- self.assertIn('-s ABSL_STRING, --absl_string ABSL_STRING', help_message)
++ if sys.version_info >= (3, 13):
++ self.assertIn(' -s, --absl_string ABSL_STRING', help_message)
++ else:
++ self.assertIn(' -s ABSL_STRING, --absl_string ABSL_STRING', help_message)
+ # Verify help messages.
+ self.assertIn('help for --absl_string=%.', help_message)
+ self.assertIn('<apple|orange>: help for --absl_enum.', help_message)
+diff --git a/absl/testing/tests/parameterized_test.py b/absl/testing/tests/parameterized_test.py
+index 609c5571..4c024927 100644
+--- a/absl/testing/tests/parameterized_test.py
++++ b/absl/testing/tests/parameterized_test.py
+@@ -1128,6 +1128,9 @@ def test_successful_execution(self):
+ self.assertEqual(2, res.testsRun)
+ self.assertTrue(res.wasSuccessful())
+
++ @unittest.skipIf(
++ sys.version_info >= (3, 13), 'makeSuite was removed in Python 3.13'
++ )
+ def test_metaclass_side_effects(self):
+ ts = unittest.makeSuite(self.MyParams, suiteClass=self.MySuite)
+
+diff --git a/absl/testing/tests/xml_reporter_test.py b/absl/testing/tests/xml_reporter_test.py
+index ba8a88f7..e0b61a98 100644
+--- a/absl/testing/tests/xml_reporter_test.py
++++ b/absl/testing/tests/xml_reporter_test.py
+@@ -85,14 +85,16 @@ def xml_escaped_exception_type(exception_type):
+ FAILURE_MESSAGE = r"""
+ <failure message="e" type="{}"><!\[CDATA\[Traceback \(most recent call last\):
+ File ".*xml_reporter_test\.py", line \d+, in get_sample_failure
+- self.fail\(\'e\'\)
++ self.fail\(\'e\'\)(
++ ~~~~~~~~~\^\^\^\^\^)?
+ AssertionError: e
+ \]\]></failure>""".format(xml_escaped_exception_type(AssertionError))
+
+ ERROR_MESSAGE = r"""
+ <error message="invalid&#x20;literal&#x20;for&#x20;int\(\)&#x20;with&#x20;base&#x20;10:&#x20;(&apos;)?a(&apos;)?" type="{}"><!\[CDATA\[Traceback \(most recent call last\):
+ File ".*xml_reporter_test\.py", line \d+, in get_sample_error
+- int\('a'\)
++ int\('a'\)(
++ ~~~\^\^\^\^\^)?
+ ValueError: invalid literal for int\(\) with base 10: '?a'?
+ \]\]></error>""".format(xml_escaped_exception_type(ValueError))
+