1 |
commit: 5d0ac520552ced3322591a1520dac70062ca3e64 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 1 14:15:10 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 1 14:16:39 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d0ac520 |
7 |
|
8 |
dev-python/rich: Add pypy3 love |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/rich/files/rich-11.1.0-pypy3.patch | 129 ++++++++++++++++++++++++++ |
13 |
dev-python/rich/rich-11.1.0.ebuild | 6 +- |
14 |
2 files changed, 134 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/dev-python/rich/files/rich-11.1.0-pypy3.patch b/dev-python/rich/files/rich-11.1.0-pypy3.patch |
17 |
new file mode 100644 |
18 |
index 000000000000..09a7f8022e26 |
19 |
--- /dev/null |
20 |
+++ b/dev-python/rich/files/rich-11.1.0-pypy3.patch |
21 |
@@ -0,0 +1,129 @@ |
22 |
+From 8e3a0be6fbb9186fa45cc42ec833d0895d2313ba Mon Sep 17 00:00:00 2001 |
23 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
24 |
+Date: Tue, 1 Feb 2022 12:24:18 +0100 |
25 |
+Subject: [PATCH 1/2] Fix test_syntax not to use identity comparison on string |
26 |
+ |
27 |
+Fix test_syntax to compare strings via "==" rather than "is", in order |
28 |
+to fix test failure on PyPy3. |
29 |
+--- |
30 |
+ CHANGELOG.md | 4 ++++ |
31 |
+ CONTRIBUTORS.md | 1 + |
32 |
+ tests/test_syntax.py | 2 +- |
33 |
+ 3 files changed, 6 insertions(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/CHANGELOG.md b/CHANGELOG.md |
36 |
+index 4997ae3..17f3028 100644 |
37 |
+--- a/CHANGELOG.md |
38 |
++++ b/CHANGELOG.md |
39 |
+@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
40 |
+ |
41 |
+ - Add support for US spelling of "gray" in ANSI color names https://github.com/Textualize/rich/issues/1890 |
42 |
+ |
43 |
++### Fixed |
44 |
++ |
45 |
++- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 https://github.com/Textualize/rich/pull/1904 |
46 |
++ |
47 |
+ ## [11.1.0] - 2022-01-28 |
48 |
+ |
49 |
+ ### Added |
50 |
+diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md |
51 |
+index c29cd79..06e0618 100644 |
52 |
+--- a/CONTRIBUTORS.md |
53 |
++++ b/CONTRIBUTORS.md |
54 |
+@@ -27,3 +27,4 @@ The following people have contributed to the development of Rich: |
55 |
+ - [Nicolas Simonds](https://github.com/0xDEC0DE) |
56 |
+ - [Gabriele N. Tornetta](https://github.com/p403n1x87) |
57 |
+ - [Patrick Arminio](https://github.com/patrick91) |
58 |
++- [Michał Górny](https://github.com/mgorny) |
59 |
+diff --git a/tests/test_syntax.py b/tests/test_syntax.py |
60 |
+index 46d0126..e5d904f 100644 |
61 |
+--- a/tests/test_syntax.py |
62 |
++++ b/tests/test_syntax.py |
63 |
+@@ -277,7 +277,7 @@ def test_from_path_lexer_override(): |
64 |
+ try: |
65 |
+ os.write(fh, b"import this\n") |
66 |
+ syntax = Syntax.from_path(path, lexer="rust") |
67 |
+- assert syntax.lexer.name is "Rust" |
68 |
++ assert syntax.lexer.name == "Rust" |
69 |
+ assert syntax.code == "import this\n" |
70 |
+ finally: |
71 |
+ os.remove(path) |
72 |
+-- |
73 |
+2.35.1 |
74 |
+ |
75 |
+From f15dc3ea0b59d5fc04341d3f634f0e61c05a84db Mon Sep 17 00:00:00 2001 |
76 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
77 |
+Date: Tue, 1 Feb 2022 15:10:32 +0100 |
78 |
+Subject: [PATCH 2/2] Fix test_inspect failures on PyPy3 |
79 |
+ |
80 |
+Mark the test_inspect tests failing on PyPy3 due to different output |
81 |
+to be skipped appropriately. |
82 |
+--- |
83 |
+ CHANGELOG.md | 2 +- |
84 |
+ tests/test_inspect.py | 9 +++++++++ |
85 |
+ 2 files changed, 10 insertions(+), 1 deletion(-) |
86 |
+ |
87 |
+diff --git a/CHANGELOG.md b/CHANGELOG.md |
88 |
+index 17f3028..1a75bf3 100644 |
89 |
+--- a/CHANGELOG.md |
90 |
++++ b/CHANGELOG.md |
91 |
+@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
92 |
+ |
93 |
+ ### Fixed |
94 |
+ |
95 |
+-- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 https://github.com/Textualize/rich/pull/1904 |
96 |
++- Fixed test failures on PyPy3 https://github.com/Textualize/rich/pull/1904 |
97 |
+ |
98 |
+ ## [11.1.0] - 2022-01-28 |
99 |
+ |
100 |
+diff --git a/tests/test_inspect.py b/tests/test_inspect.py |
101 |
+index 63c5f06..b4c1d2a 100644 |
102 |
+--- a/tests/test_inspect.py |
103 |
++++ b/tests/test_inspect.py |
104 |
+@@ -32,6 +32,11 @@ skip_py310 = pytest.mark.skipif( |
105 |
+ reason="rendered differently on py3.10", |
106 |
+ ) |
107 |
+ |
108 |
++skip_pypy3 = pytest.mark.skipif( |
109 |
++ hasattr(sys, "pypy_version_info"), |
110 |
++ reason="rendered differently on pypy3", |
111 |
++) |
112 |
++ |
113 |
+ |
114 |
+ def render(obj, methods=False, value=False, width=50) -> str: |
115 |
+ console = Console(file=io.StringIO(), width=width, legacy_windows=False) |
116 |
+@@ -81,6 +86,7 @@ def test_render(): |
117 |
+ assert expected == result |
118 |
+ |
119 |
+ |
120 |
++@skip_pypy3 |
121 |
+ def test_inspect_text(): |
122 |
+ expected = ( |
123 |
+ "╭──────────────── <class 'str'> ─────────────────╮\n" |
124 |
+@@ -98,6 +104,7 @@ def test_inspect_text(): |
125 |
+ |
126 |
+ @skip_py36 |
127 |
+ @skip_py37 |
128 |
++@skip_pypy3 |
129 |
+ def test_inspect_empty_dict(): |
130 |
+ expected = ( |
131 |
+ "╭──────────────── <class 'dict'> ────────────────╮\n" |
132 |
+@@ -119,6 +126,7 @@ def test_inspect_empty_dict(): |
133 |
+ assert render({}).startswith(expected) |
134 |
+ |
135 |
+ |
136 |
++@skip_pypy3 |
137 |
+ def test_inspect_builtin_function(): |
138 |
+ expected = ( |
139 |
+ "╭────────── <built-in function print> ───────────╮\n" |
140 |
+@@ -237,6 +245,7 @@ def test_inspect_integer_with_methods(): |
141 |
+ |
142 |
+ @skip_py36 |
143 |
+ @skip_py37 |
144 |
++@skip_pypy3 |
145 |
+ def test_broken_call_attr(): |
146 |
+ class NotCallable: |
147 |
+ __call__ = 5 # Passes callable() but isn't really callable |
148 |
+-- |
149 |
+2.35.1 |
150 |
+ |
151 |
|
152 |
diff --git a/dev-python/rich/rich-11.1.0.ebuild b/dev-python/rich/rich-11.1.0.ebuild |
153 |
index 76113d1d7315..7fab6ef8c8cf 100644 |
154 |
--- a/dev-python/rich/rich-11.1.0.ebuild |
155 |
+++ b/dev-python/rich/rich-11.1.0.ebuild |
156 |
@@ -4,7 +4,7 @@ |
157 |
EAPI=8 |
158 |
|
159 |
DISTUTILS_USE_PEP517=poetry |
160 |
-PYTHON_COMPAT=( python3_{8..10} ) |
161 |
+PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
162 |
inherit distutils-r1 optfeature |
163 |
|
164 |
DESCRIPTION="Python library for renrering rich text, tables, etc. to the terminal" |
165 |
@@ -25,6 +25,10 @@ RDEPEND=" |
166 |
|
167 |
distutils_enable_tests pytest |
168 |
|
169 |
+PATCHES=( |
170 |
+ "${FILESDIR}"/${P}-pypy3.patch |
171 |
+) |
172 |
+ |
173 |
python_test() { |
174 |
local EPYTEST_DESELECT=( |
175 |
# check for exact color render string, which changes across pygments bumps |