dev-python/freezegun: Enable python3.10

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2021-05-07 22:54:23 +02:00
parent a3f056777c
commit d030418412
2 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
From 57d024e4ce2516c55c715448296b9099db68343c Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Fri, 7 May 2021 15:51:33 +0000
Subject: [PATCH] Fix decorate_class for Python 3.10 where staticmethod is
callable.
(edited by mgorny for more readable indent)
---
freezegun/api.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/freezegun/api.py b/freezegun/api.py
index cab9ebe..eb3a931 100644
--- a/freezegun/api.py
+++ b/freezegun/api.py
@@ -598,7 +598,10 @@ class _freeze_time(object):
continue
seen.add(attr)
- if not callable(attr_value) or inspect.isclass(attr_value):
+ # staticmethods are callable from Python 3.10 . Hence skip them from decoration
+ if (not callable(attr_value)
+ or inspect.isclass(attr_value)
+ or isinstance(attr_value, staticmethod)):
continue
try:
--
2.31.1

View File

@@ -0,0 +1,31 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{7..10} pypy3 )
inherit distutils-r1
DESCRIPTION="Let your Python tests travel through time"
HOMEPAGE="https://github.com/spulec/freezegun"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
RDEPEND="
>dev-python/python-dateutil-2.7[${PYTHON_USEDEP}]
"
BDEPEND="
test? (
$(python_gen_impl_dep sqlite)
dev-python/nose[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/${P}-py310.patch
)