dev-python/colorclass: bump to python 3.10

passes tests

Signed-off-by: Zamarin Arthur <arthurzam@gmail.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Zamarin Arthur
2021-05-23 08:16:55 +03:00
committed by Michał Górny
parent e3889bbab3
commit ca4427ca85
2 changed files with 32 additions and 3 deletions

View File

@@ -1,9 +1,9 @@
# Copyright 2019-2020 Gentoo Authors
# Copyright 2019-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..9} pypy3 )
PYTHON_COMPAT=( python3_{7..10} pypy3 )
inherit distutils-r1
DESCRIPTION="Colorful worry-free console applications for multiple platforms"
@@ -15,7 +15,8 @@ SLOT="0"
KEYWORDS="amd64 ~arm64 x86"
PATCHES=(
"${FILESDIR}/colorclass-2.2.0-tests.patch"
"${FILESDIR}/${P}-tests.patch"
"${FILESDIR}/${P}-fix-py3.10.patch"
)
distutils_enable_tests pytest

View File

@@ -0,0 +1,28 @@
From f8bbe9fdcff1d97b1d0e5dcb94680923cc43a507 Mon Sep 17 00:00:00 2001
From: Ralph Broenink <ralph@ralphbroenink.net>
Date: Mon, 24 Aug 2020 14:49:24 +0200
Subject: [PATCH] Make code forwards-compatible with Python 3.9
Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
---
colorclass/codes.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/colorclass/codes.py b/colorclass/codes.py
index b0ecb03..8b6085d 100644
--- a/colorclass/codes.py
+++ b/colorclass/codes.py
@@ -1,7 +1,12 @@
"""Handles mapping between color names and ANSI codes and determining auto color codes."""
import sys
-from collections import Mapping
+try:
+ # Using or importing the ABCs from 'collections' instead of from 'collections.abc' is
+ # deprecated since Python 3.3, and in 3.9 it will stop working
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
BASE_CODES = {
'/all': 0, 'b': 1, 'f': 2, 'i': 3, 'u': 4, 'flash': 5, 'outline': 6, 'negative': 7, 'invis': 8, 'strike': 9,