summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Kostecki <conikost@gentoo.org>2020-10-18 15:25:28 +0200
committerConrad Kostecki <conikost@gentoo.org>2020-10-18 15:25:28 +0200
commitcff994e70fc59d554f605bd2c9140f75eee51f4e (patch)
treebf93148d59d5573fc509230181a61c994f2ab837 /dev-python/pyxdg
parentdev-lua/lua-bit32: drop old version (diff)
downloadgentoo-cff994e70fc59d554f605bd2c9140f75eee51f4e.tar.gz
gentoo-cff994e70fc59d554f605bd2c9140f75eee51f4e.tar.bz2
gentoo-cff994e70fc59d554f605bd2c9140f75eee51f4e.zip
dev-python/pyxdg: fix tests
This patch fixes tests with python 3.8.4 and newer. Closes: https://bugs.gentoo.org/735746 Closes: https://bugs.gentoo.org/743823 Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
Diffstat (limited to 'dev-python/pyxdg')
-rw-r--r--dev-python/pyxdg/files/pyxdg-0.26-python384.patch58
-rw-r--r--dev-python/pyxdg/pyxdg-0.26-r2.ebuild20
2 files changed, 65 insertions, 13 deletions
diff --git a/dev-python/pyxdg/files/pyxdg-0.26-python384.patch b/dev-python/pyxdg/files/pyxdg-0.26-python384.patch
new file mode 100644
index 000000000000..def4a835f036
--- /dev/null
+++ b/dev-python/pyxdg/files/pyxdg-0.26-python384.patch
@@ -0,0 +1,58 @@
+From 9b913229ace838958e51a16cabc41905a2460f7b Mon Sep 17 00:00:00 2001
+From: Conrad Kostecki <conrad@kostecki.com>
+Date: Tue, 25 Aug 2020 00:24:53 +0200
+Subject: [PATCH] Fix compatibility with >=python-3.8.4
+
+Signed-off-by: Conrad Kostecki <conrad@kostecki.com>
+---
+ xdg/Menu.py | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/xdg/Menu.py b/xdg/Menu.py
+index 1d03cad..ee406bd 100644
+--- a/xdg/Menu.py
++++ b/xdg/Menu.py
+@@ -21,6 +21,7 @@ def print_menu(menu, tab=0):
+ import locale
+ import subprocess
+ import ast
++import sys
+ try:
+ import xml.etree.cElementTree as etree
+ except ImportError:
+@@ -35,6 +36,17 @@ def print_menu(menu, tab=0):
+ import xdg.Config
+
+
++def _ast_const(name):
++ if sys.version_info >= (3, 4):
++ name = ast.literal_eval(name)
++ if sys.version_info >= (3, 8):
++ return ast.Constant(name)
++ else:
++ return ast.NameConstant(name)
++ else:
++ return ast.Name(id=name, ctx=ast.Load())
++
++
+ def _strxfrm(s):
+ """Wrapper around locale.strxfrm that accepts unicode strings on Python 2.
+
+@@ -754,7 +766,7 @@ def parse_rule(self, node):
+ if expr:
+ tree.body = expr
+ else:
+- tree.body = ast.Name('False', ast.Load())
++ tree.body = _ast_const('False')
+ ast.fix_missing_locations(tree)
+ return Rule(type, tree)
+
+@@ -781,7 +793,7 @@ def parse_rule_node(self, node):
+ expr = self.parse_bool_op(node, ast.Or())
+ return ast.UnaryOp(ast.Not(), expr) if expr else None
+ elif tag == 'All':
+- return ast.Name('True', ast.Load())
++ return _ast_const('True')
+ elif tag == 'Category':
+ category = node.text
+ return ast.Compare(
diff --git a/dev-python/pyxdg/pyxdg-0.26-r2.ebuild b/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
index 94de62c59600..b86bc4b81e90 100644
--- a/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
+++ b/dev-python/pyxdg/pyxdg-0.26-r2.ebuild
@@ -3,16 +3,16 @@
EAPI=7
-DISTUTILS_USE_SETUPTOOLS=no
+DISTUTILS_USE_SETUPTOOLS="no"
+MY_P="${PN}-rel-${PV}"
PYTHON_COMPAT=( python{3_6,3_7,3_8,3_9} )
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://cgit.freedesktop.org/xdg/pyxdg/"
-# official mirror of the git repo
-SRC_URI="https://github.com/takluyver/pyxdg/archive/rel-${PV}.tar.gz -> ${MY_P}.tar.gz"
+SRC_URI="https://github.com/takluyver/${PN}/archive/rel-${PV}.tar.gz -> ${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
LICENSE="LGPL-2"
SLOT="0"
@@ -20,14 +20,8 @@ KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 sparc x86"
IUSE="test"
RESTRICT="!test? ( test )"
-DEPEND="
- test? (
- dev-python/nose[${PYTHON_USEDEP}]
- x11-themes/hicolor-icon-theme
- )"
+DEPEND="test? ( x11-themes/hicolor-icon-theme )"
-S=${WORKDIR}/${MY_P}
+PATCHES=( "${FILESDIR}/${P}-python384.patch" )
-python_test() {
- nosetests -v || die
-}
+distutils_enable_tests nose