1 |
commit: 46b5dffed4d5d8fff2592c4e9f9a731b8235ff03 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 29 14:11:02 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 30 07:40:19 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=46b5dffe |
7 |
|
8 |
dev-python/deprecated: Port to py39 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/deprecated/deprecated-1.2.10.ebuild | 7 ++- |
13 |
dev-python/deprecated/deprecated-1.2.9.ebuild | 1 - |
14 |
.../deprecated/files/deprecated-1.2.10-py39.patch | 57 ++++++++++++++++++++++ |
15 |
3 files changed, 62 insertions(+), 3 deletions(-) |
16 |
|
17 |
diff --git a/dev-python/deprecated/deprecated-1.2.10.ebuild b/dev-python/deprecated/deprecated-1.2.10.ebuild |
18 |
index a5088d2c205..b2b1fcd65d1 100644 |
19 |
--- a/dev-python/deprecated/deprecated-1.2.10.ebuild |
20 |
+++ b/dev-python/deprecated/deprecated-1.2.10.ebuild |
21 |
@@ -3,7 +3,7 @@ |
22 |
|
23 |
EAPI=7 |
24 |
|
25 |
-PYTHON_COMPAT=( python3_{6,7,8} pypy3 ) |
26 |
+PYTHON_COMPAT=( python3_{6..9} pypy3 ) |
27 |
inherit distutils-r1 |
28 |
|
29 |
DESCRIPTION="Python @deprecated decorator to deprecate old API" |
30 |
@@ -15,6 +15,9 @@ SLOT="0" |
31 |
KEYWORDS="~amd64 ~x86" |
32 |
|
33 |
RDEPEND="dev-python/wrapt[${PYTHON_USEDEP}]" |
34 |
-BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]" |
35 |
|
36 |
distutils_enable_tests pytest |
37 |
+ |
38 |
+PATCHES=( |
39 |
+ "${FILESDIR}"/${P}-py39.patch |
40 |
+) |
41 |
|
42 |
diff --git a/dev-python/deprecated/deprecated-1.2.9.ebuild b/dev-python/deprecated/deprecated-1.2.9.ebuild |
43 |
index a6bed5059a0..cf3f9570dd6 100644 |
44 |
--- a/dev-python/deprecated/deprecated-1.2.9.ebuild |
45 |
+++ b/dev-python/deprecated/deprecated-1.2.9.ebuild |
46 |
@@ -15,6 +15,5 @@ SLOT="0" |
47 |
KEYWORDS="amd64 x86" |
48 |
|
49 |
RDEPEND="dev-python/wrapt[${PYTHON_USEDEP}]" |
50 |
-BDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]" |
51 |
|
52 |
distutils_enable_tests pytest |
53 |
|
54 |
diff --git a/dev-python/deprecated/files/deprecated-1.2.10-py39.patch b/dev-python/deprecated/files/deprecated-1.2.10-py39.patch |
55 |
new file mode 100644 |
56 |
index 00000000000..42ab81445b7 |
57 |
--- /dev/null |
58 |
+++ b/dev-python/deprecated/files/deprecated-1.2.10-py39.patch |
59 |
@@ -0,0 +1,57 @@ |
60 |
+From 629e7b702ede03262afeb86cd7a6d42d739504d2 Mon Sep 17 00:00:00 2001 |
61 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
62 |
+Date: Sat, 30 May 2020 09:30:58 +0200 |
63 |
+Subject: [PATCH] Update expected class method deprecation msgs in tests for |
64 |
+ py3.9 |
65 |
+ |
66 |
+Python 3.9 has fixed @classmethod combining with other decorators, |
67 |
+making deprecated correctly report 'class method' (instead of function |
68 |
+or static method). Update the tests to account for that. |
69 |
+ |
70 |
+Fixes #29 |
71 |
+--- |
72 |
+ tests/test_deprecated.py | 6 +++++- |
73 |
+ tests/test_sphinx.py | 5 ++++- |
74 |
+ 2 files changed, 9 insertions(+), 2 deletions(-) |
75 |
+ |
76 |
+diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py |
77 |
+index 3796640..e4c00ef 100644 |
78 |
+--- a/tests/test_deprecated.py |
79 |
++++ b/tests/test_deprecated.py |
80 |
+@@ -1,4 +1,5 @@ |
81 |
+ # -*- coding: utf-8 -*- |
82 |
++import sys |
83 |
+ import warnings |
84 |
+ |
85 |
+ import pytest |
86 |
+@@ -184,7 +185,10 @@ def test_classic_deprecated_class_method__warns(classic_deprecated_class_method) |
87 |
+ assert len(warns) == 1 |
88 |
+ warn = warns[0] |
89 |
+ assert issubclass(warn.category, DeprecationWarning) |
90 |
+- assert "deprecated function (or staticmethod)" in str(warn.message) |
91 |
++ if sys.version_info >= (3, 9): |
92 |
++ assert "deprecated class method" in str(warn.message) |
93 |
++ else: |
94 |
++ assert "deprecated function (or staticmethod)" in str(warn.message) |
95 |
+ assert warn.filename == __file__, 'Incorrect warning stackLevel' |
96 |
+ |
97 |
+ |
98 |
+diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py |
99 |
+index 42f2460..efc8628 100644 |
100 |
+--- a/tests/test_sphinx.py |
101 |
++++ b/tests/test_sphinx.py |
102 |
+@@ -334,7 +334,10 @@ def test_sphinx_deprecated_class_method__warns(sphinx_deprecated_class_method): |
103 |
+ assert len(warns) == 1 |
104 |
+ warn = warns[0] |
105 |
+ assert issubclass(warn.category, DeprecationWarning) |
106 |
+- assert "deprecated function (or staticmethod)" in str(warn.message) |
107 |
++ if sys.version_info >= (3, 9): |
108 |
++ assert "deprecated class method" in str(warn.message) |
109 |
++ else: |
110 |
++ assert "deprecated function (or staticmethod)" in str(warn.message) |
111 |
+ |
112 |
+ |
113 |
+ def test_should_raise_type_error(): |
114 |
+-- |
115 |
+2.26.2 |
116 |
+ |