summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-11-07 15:09:34 +0100
committerMichał Górny <mgorny@gentoo.org>2023-11-07 16:18:54 +0100
commit99445b2c0d03eea4e58e50284cb6362b8922eff5 (patch)
tree05f0ef3b2e09a72207dc1dd178ec4098d1e1629c /dev-python/translate-toolkit
parentapp-emulation/plus42: add 1.0.21 (diff)
downloadgentoo-99445b2c0d03eea4e58e50284cb6362b8922eff5.tar.gz
gentoo-99445b2c0d03eea4e58e50284cb6362b8922eff5.tar.bz2
gentoo-99445b2c0d03eea4e58e50284cb6362b8922eff5.zip
dev-python/translate-toolkit: Enable py3.12
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/translate-toolkit')
-rw-r--r--dev-python/translate-toolkit/files/translate-toolkit-3.10.1-py312.patch36
-rw-r--r--dev-python/translate-toolkit/translate-toolkit-3.10.1-r1.ebuild (renamed from dev-python/translate-toolkit/translate-toolkit-3.10.1.ebuild)8
2 files changed, 42 insertions, 2 deletions
diff --git a/dev-python/translate-toolkit/files/translate-toolkit-3.10.1-py312.patch b/dev-python/translate-toolkit/files/translate-toolkit-3.10.1-py312.patch
new file mode 100644
index 000000000000..da0fd91520aa
--- /dev/null
+++ b/dev-python/translate-toolkit/files/translate-toolkit-3.10.1-py312.patch
@@ -0,0 +1,36 @@
+From 3217ed10bb9371ff25cb04e194e0250d42f89206 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= <michal@cihar.com>
+Date: Tue, 7 Nov 2023 08:42:56 +0100
+Subject: [PATCH] optrecurse: properly close opened files
+
+This avoids leaking file descriptors in the tests and makes sure the
+content is written at the end of conversion.
+
+Fixes #5071
+---
+ translate/misc/optrecurse.py | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/translate/misc/optrecurse.py b/translate/misc/optrecurse.py
+index d69666b8e8..9337c7c4ff 100644
+--- a/translate/misc/optrecurse.py
++++ b/translate/misc/optrecurse.py
+@@ -684,10 +684,17 @@ def processfile(
+ tempoutput = False
+ templatefile = self.opentemplatefile(options, fulltemplatepath)
+ passthroughoptions = self.getpassthroughoptions(options)
+- if fileprocessor(inputfile, outputfile, templatefile, **passthroughoptions):
++ result = fileprocessor(
++ inputfile, outputfile, templatefile, **passthroughoptions
++ )
++ if fullinputpath is not None:
++ inputfile.close()
++ if result:
+ if tempoutput:
+ self.warning("writing to temporary output...")
+ self.finalizetempoutputfile(options, outputfile, fulloutputpath)
++ if fulloutputpath and os.path.isfile(fulloutputpath):
++ outputfile.close()
+ return True
+ else:
+ # remove the file if it is a file (could be stdout etc)
diff --git a/dev-python/translate-toolkit/translate-toolkit-3.10.1.ebuild b/dev-python/translate-toolkit/translate-toolkit-3.10.1-r1.ebuild
index 77dcd8f1db85..507a80f7bb74 100644
--- a/dev-python/translate-toolkit/translate-toolkit-3.10.1.ebuild
+++ b/dev-python/translate-toolkit/translate-toolkit-3.10.1-r1.ebuild
@@ -4,8 +4,7 @@
EAPI=8
DISTUTILS_USE_PEP517=setuptools
-# py3.12: https://github.com/translate/translate/issues/5071
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
PYTHON_REQ_USE="sqlite"
inherit distutils-r1
@@ -52,6 +51,11 @@ BDEPEND="
)
"
+PATCHES=(
+ # https://github.com/translate/translate/commit/3217ed10bb9371ff25cb04e194e0250d42f89206
+ "${FILESDIR}/${P}-py312.patch"
+)
+
distutils_enable_tests pytest
src_test() {