commit:     501fafd77c118f6ac09db8a3a019df2ea425c392
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 31 17:58:04 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 31 17:59:08 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=501fafd7

dev-python/pyxdg: enable py3.14

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/pyxdg/files/pyxdg-0.28-py3.14.patch | 89 ++++++++++++++++++++++++++
 dev-python/pyxdg/pyxdg-0.28-r2.ebuild          | 32 +++++++++
 2 files changed, 121 insertions(+)

diff --git a/dev-python/pyxdg/files/pyxdg-0.28-py3.14.patch 
b/dev-python/pyxdg/files/pyxdg-0.28-py3.14.patch
new file mode 100644
index 000000000000..4521adfbf1ab
--- /dev/null
+++ b/dev-python/pyxdg/files/pyxdg-0.28-py3.14.patch
@@ -0,0 +1,89 @@
+https://gitlab.freedesktop.org/xdg/pyxdg/-/merge_requests/17
+
+From 9291d419017263c922869d79ac1fe8d423e5f929 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Sat, 31 May 2025 18:52:45 +0100
+Subject: [PATCH 1/2] Menu: handle Python 3.14 ast.Str changes
+
+ast.Str is gone and replaced by ast.Constant.
+---
+ xdg/Menu.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/xdg/Menu.py b/xdg/Menu.py
+index 1dd2af5..71f5e61 100644
+--- a/xdg/Menu.py
++++ b/xdg/Menu.py
+@@ -411,7 +411,7 @@ class Rule:
+     def fromFilename(cls, type, filename):
+         tree = ast.Expression(
+             body=ast.Compare(
+-                left=ast.Str(filename),
++                left=ast.Constant(filename),
+                 ops=[ast.Eq()],
+                 comparators=[ast.Attribute(
+                     value=ast.Name(id='menuentry', ctx=ast.Load()),
+@@ -799,7 +799,7 @@ class XMLMenuBuilder(object):
+         elif tag == 'Category':
+             category = node.text
+             return ast.Compare(
+-                left=ast.Str(category),
++                left=ast.Constant(category),
+                 ops=[ast.In()],
+                 comparators=[ast.Attribute(
+                     value=ast.Name(id='menuentry', ctx=ast.Load()),
+@@ -810,7 +810,7 @@ class XMLMenuBuilder(object):
+         elif tag == 'Filename':
+             filename = node.text
+             return ast.Compare(
+-                left=ast.Str(filename),
++                left=ast.Constant(filename),
+                 ops=[ast.Eq()],
+                 comparators=[ast.Attribute(
+                     value=ast.Name(id='menuentry', ctx=ast.Load()),
+-- 
+GitLab
+
+
+From 63033ac306aa26d32e1439417e59ae8f8a4c9820 Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Sat, 31 May 2025 18:54:51 +0100
+Subject: [PATCH 2/2] Menu: handle Python 3.15 deprecations
+
+* Unknown keyword args will be fatal, so drop lineno/col_offset that
+  is unused
+* Set body= immediately as a keyword
+---
+ xdg/Menu.py | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/xdg/Menu.py b/xdg/Menu.py
+index 71f5e61..8e1595c 100644
+--- a/xdg/Menu.py
++++ b/xdg/Menu.py
+@@ -419,7 +419,6 @@ class Rule:
+                     ctx=ast.Load()
+                 )]
+             ),
+-            lineno=1, col_offset=0
+         )
+         ast.fix_missing_locations(tree)
+         rule = Rule(type, tree)
+@@ -763,12 +762,10 @@ class XMLMenuBuilder(object):
+ 
+     def parse_rule(self, node):
+         type = Rule.TYPE_INCLUDE if node.tag == 'Include' else 
Rule.TYPE_EXCLUDE
+-        tree = ast.Expression(lineno=1, col_offset=0)
++        tree = ast.Expression(body=_ast_const('False'))
+         expr = self.parse_bool_op(node, ast.Or())
+         if expr:
+             tree.body = expr
+-        else:
+-            tree.body = _ast_const('False')
+         ast.fix_missing_locations(tree)
+         return Rule(type, tree)
+ 
+-- 
+GitLab
+
+

diff --git a/dev-python/pyxdg/pyxdg-0.28-r2.ebuild 
b/dev-python/pyxdg/pyxdg-0.28-r2.ebuild
new file mode 100644
index 000000000000..c098fbf6a793
--- /dev/null
+++ b/dev-python/pyxdg/pyxdg-0.28-r2.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
+DISTUTILS_USE_PEP517=setuptools
+
+inherit distutils-r1
+
+MY_P="${PN}-rel-${PV}"
+DESCRIPTION="A Python module to deal with freedesktop.org specifications"
+HOMEPAGE="
+       https://freedesktop.org/wiki/Software/pyxdg/
+       https://pypi.org/project/pyxdg/
+"
+SRC_URI="
+       https://github.com/takluyver/pyxdg/archive/rel-${PV}.tar.gz
+               -> ${MY_P}.gh.tar.gz
+"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.28-py3.12.patch
+       "${FILESDIR}"/${PN}-0.28-py3.14.patch
+)
+
+distutils_enable_tests pytest

Reply via email to