Gentoo Archives: gentoo-commits

From: Conrad Kostecki <conikost@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pyxdg/files/, dev-python/pyxdg/
Date: Sun, 18 Oct 2020 13:27:31
Message-Id: 1603027528.cff994e70fc59d554f605bd2c9140f75eee51f4e.conikost@gentoo
1 commit: cff994e70fc59d554f605bd2c9140f75eee51f4e
2 Author: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 18 13:25:28 2020 +0000
4 Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 18 13:25:28 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cff994e7
7
8 dev-python/pyxdg: fix tests
9
10 This patch fixes tests with python 3.8.4 and newer.
11
12 Closes: https://bugs.gentoo.org/735746
13 Closes: https://bugs.gentoo.org/743823
14 Package-Manager: Portage-3.0.8, Repoman-3.0.1
15 Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
16
17 dev-python/pyxdg/files/pyxdg-0.26-python384.patch | 58 +++++++++++++++++++++++
18 dev-python/pyxdg/pyxdg-0.26-r2.ebuild | 20 +++-----
19 2 files changed, 65 insertions(+), 13 deletions(-)
20
21 diff --git a/dev-python/pyxdg/files/pyxdg-0.26-python384.patch b/dev-python/pyxdg/files/pyxdg-0.26-python384.patch
22 new file mode 100644
23 index 00000000000..def4a835f03
24 --- /dev/null
25 +++ b/dev-python/pyxdg/files/pyxdg-0.26-python384.patch
26 @@ -0,0 +1,58 @@
27 +From 9b913229ace838958e51a16cabc41905a2460f7b Mon Sep 17 00:00:00 2001
28 +From: Conrad Kostecki <conrad@××××××××.com>
29 +Date: Tue, 25 Aug 2020 00:24:53 +0200
30 +Subject: [PATCH] Fix compatibility with >=python-3.8.4
31 +
32 +Signed-off-by: Conrad Kostecki <conrad@××××××××.com>
33 +---
34 + xdg/Menu.py | 16 ++++++++++++++--
35 + 1 file changed, 14 insertions(+), 2 deletions(-)
36 +
37 +diff --git a/xdg/Menu.py b/xdg/Menu.py
38 +index 1d03cad..ee406bd 100644
39 +--- a/xdg/Menu.py
40 ++++ b/xdg/Menu.py
41 +@@ -21,6 +21,7 @@ def print_menu(menu, tab=0):
42 + import locale
43 + import subprocess
44 + import ast
45 ++import sys
46 + try:
47 + import xml.etree.cElementTree as etree
48 + except ImportError:
49 +@@ -35,6 +36,17 @@ def print_menu(menu, tab=0):
50 + import xdg.Config
51 +
52 +
53 ++def _ast_const(name):
54 ++ if sys.version_info >= (3, 4):
55 ++ name = ast.literal_eval(name)
56 ++ if sys.version_info >= (3, 8):
57 ++ return ast.Constant(name)
58 ++ else:
59 ++ return ast.NameConstant(name)
60 ++ else:
61 ++ return ast.Name(id=name, ctx=ast.Load())
62 ++
63 ++
64 + def _strxfrm(s):
65 + """Wrapper around locale.strxfrm that accepts unicode strings on Python 2.
66 +
67 +@@ -754,7 +766,7 @@ def parse_rule(self, node):
68 + if expr:
69 + tree.body = expr
70 + else:
71 +- tree.body = ast.Name('False', ast.Load())
72 ++ tree.body = _ast_const('False')
73 + ast.fix_missing_locations(tree)
74 + return Rule(type, tree)
75 +
76 +@@ -781,7 +793,7 @@ def parse_rule_node(self, node):
77 + expr = self.parse_bool_op(node, ast.Or())
78 + return ast.UnaryOp(ast.Not(), expr) if expr else None
79 + elif tag == 'All':
80 +- return ast.Name('True', ast.Load())
81 ++ return _ast_const('True')
82 + elif tag == 'Category':
83 + category = node.text
84 + return ast.Compare(
85
86 diff --git a/dev-python/pyxdg/pyxdg-0.26-r2.ebuild b/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
87 index 94de62c5960..b86bc4b81e9 100644
88 --- a/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
89 +++ b/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
90 @@ -3,16 +3,16 @@
91
92 EAPI=7
93
94 -DISTUTILS_USE_SETUPTOOLS=no
95 +DISTUTILS_USE_SETUPTOOLS="no"
96 +MY_P="${PN}-rel-${PV}"
97 PYTHON_COMPAT=( python{3_6,3_7,3_8,3_9} )
98
99 inherit distutils-r1
100
101 -MY_P=${PN}-rel-${PV}
102 DESCRIPTION="A Python module to deal with freedesktop.org specifications"
103 HOMEPAGE="https://freedesktop.org/wiki/Software/pyxdg https://cgit.freedesktop.org/xdg/pyxdg/"
104 -# official mirror of the git repo
105 -SRC_URI="https://github.com/takluyver/pyxdg/archive/rel-${PV}.tar.gz -> ${MY_P}.tar.gz"
106 +SRC_URI="https://github.com/takluyver/${PN}/archive/rel-${PV}.tar.gz -> ${MY_P}.tar.gz"
107 +S="${WORKDIR}/${MY_P}"
108
109 LICENSE="LGPL-2"
110 SLOT="0"
111 @@ -20,14 +20,8 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 sparc x86"
112 IUSE="test"
113 RESTRICT="!test? ( test )"
114
115 -DEPEND="
116 - test? (
117 - dev-python/nose[${PYTHON_USEDEP}]
118 - x11-themes/hicolor-icon-theme
119 - )"
120 +DEPEND="test? ( x11-themes/hicolor-icon-theme )"
121
122 -S=${WORKDIR}/${MY_P}
123 +PATCHES=( "${FILESDIR}/${P}-python384.patch" )
124
125 -python_test() {
126 - nosetests -v || die
127 -}
128 +distutils_enable_tests nose