commit:     5d0ac520552ced3322591a1520dac70062ca3e64
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  1 14:15:10 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Feb  1 14:16:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d0ac520

dev-python/rich: Add pypy3 love

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/rich/files/rich-11.1.0-pypy3.patch | 129 ++++++++++++++++++++++++++
 dev-python/rich/rich-11.1.0.ebuild            |   6 +-
 2 files changed, 134 insertions(+), 1 deletion(-)

diff --git a/dev-python/rich/files/rich-11.1.0-pypy3.patch 
b/dev-python/rich/files/rich-11.1.0-pypy3.patch
new file mode 100644
index 000000000000..09a7f8022e26
--- /dev/null
+++ b/dev-python/rich/files/rich-11.1.0-pypy3.patch
@@ -0,0 +1,129 @@
+From 8e3a0be6fbb9186fa45cc42ec833d0895d2313ba Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Tue, 1 Feb 2022 12:24:18 +0100
+Subject: [PATCH 1/2] Fix test_syntax not to use identity comparison on string
+
+Fix test_syntax to compare strings via "==" rather than "is", in order
+to fix test failure on PyPy3.
+---
+ CHANGELOG.md         | 4 ++++
+ CONTRIBUTORS.md      | 1 +
+ tests/test_syntax.py | 2 +-
+ 3 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGELOG.md b/CHANGELOG.md
+index 4997ae3..17f3028 100644
+--- a/CHANGELOG.md
++++ b/CHANGELOG.md
+@@ -11,6 +11,10 @@ and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0
+ 
+ - Add support for US spelling of "gray" in ANSI color names 
https://github.com/Textualize/rich/issues/1890
+ 
++### Fixed
++
++- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 
https://github.com/Textualize/rich/pull/1904
++
+ ## [11.1.0] - 2022-01-28
+ 
+ ### Added
+diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
+index c29cd79..06e0618 100644
+--- a/CONTRIBUTORS.md
++++ b/CONTRIBUTORS.md
+@@ -27,3 +27,4 @@ The following people have contributed to the development of 
Rich:
+ - [Nicolas Simonds](https://github.com/0xDEC0DE)
+ - [Gabriele N. Tornetta](https://github.com/p403n1x87)
+ - [Patrick Arminio](https://github.com/patrick91)
++- [Michał Górny](https://github.com/mgorny)
+diff --git a/tests/test_syntax.py b/tests/test_syntax.py
+index 46d0126..e5d904f 100644
+--- a/tests/test_syntax.py
++++ b/tests/test_syntax.py
+@@ -277,7 +277,7 @@ def test_from_path_lexer_override():
+     try:
+         os.write(fh, b"import this\n")
+         syntax = Syntax.from_path(path, lexer="rust")
+-        assert syntax.lexer.name is "Rust"
++        assert syntax.lexer.name == "Rust"
+         assert syntax.code == "import this\n"
+     finally:
+         os.remove(path)
+-- 
+2.35.1
+
+From f15dc3ea0b59d5fc04341d3f634f0e61c05a84db Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Tue, 1 Feb 2022 15:10:32 +0100
+Subject: [PATCH 2/2] Fix test_inspect failures on PyPy3
+
+Mark the test_inspect tests failing on PyPy3 due to different output
+to be skipped appropriately.
+---
+ CHANGELOG.md          | 2 +-
+ tests/test_inspect.py | 9 +++++++++
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGELOG.md b/CHANGELOG.md
+index 17f3028..1a75bf3 100644
+--- a/CHANGELOG.md
++++ b/CHANGELOG.md
+@@ -13,7 +13,7 @@ and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0
+ 
+ ### Fixed
+ 
+-- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 
https://github.com/Textualize/rich/pull/1904
++- Fixed test failures on PyPy3 https://github.com/Textualize/rich/pull/1904
+ 
+ ## [11.1.0] - 2022-01-28
+ 
+diff --git a/tests/test_inspect.py b/tests/test_inspect.py
+index 63c5f06..b4c1d2a 100644
+--- a/tests/test_inspect.py
++++ b/tests/test_inspect.py
+@@ -32,6 +32,11 @@ skip_py310 = pytest.mark.skipif(
+     reason="rendered differently on py3.10",
+ )
+ 
++skip_pypy3 = pytest.mark.skipif(
++    hasattr(sys, "pypy_version_info"),
++    reason="rendered differently on pypy3",
++)
++
+ 
+ def render(obj, methods=False, value=False, width=50) -> str:
+     console = Console(file=io.StringIO(), width=width, legacy_windows=False)
+@@ -81,6 +86,7 @@ def test_render():
+     assert expected == result
+ 
+ 
++@skip_pypy3
+ def test_inspect_text():
+     expected = (
+         "╭──────────────── <class 'str'> ─────────────────╮\n"
+@@ -98,6 +104,7 @@ def test_inspect_text():
+ 
+ @skip_py36
+ @skip_py37
++@skip_pypy3
+ def test_inspect_empty_dict():
+     expected = (
+         "╭──────────────── <class 'dict'> ────────────────╮\n"
+@@ -119,6 +126,7 @@ def test_inspect_empty_dict():
+     assert render({}).startswith(expected)
+ 
+ 
++@skip_pypy3
+ def test_inspect_builtin_function():
+     expected = (
+         "╭────────── <built-in function print> ───────────╮\n"
+@@ -237,6 +245,7 @@ def test_inspect_integer_with_methods():
+ 
+ @skip_py36
+ @skip_py37
++@skip_pypy3
+ def test_broken_call_attr():
+     class NotCallable:
+         __call__ = 5  # Passes callable() but isn't really callable
+-- 
+2.35.1
+

diff --git a/dev-python/rich/rich-11.1.0.ebuild 
b/dev-python/rich/rich-11.1.0.ebuild
index 76113d1d7315..7fab6ef8c8cf 100644
--- a/dev-python/rich/rich-11.1.0.ebuild
+++ b/dev-python/rich/rich-11.1.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=poetry
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..10} pypy3 )
 inherit distutils-r1 optfeature
 
 DESCRIPTION="Python library for renrering rich text, tables, etc. to the 
terminal"
@@ -25,6 +25,10 @@ RDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       "${FILESDIR}"/${P}-pypy3.patch
+)
+
 python_test() {
        local EPYTEST_DESELECT=(
                # check for exact color render string, which changes across 
pygments bumps

Reply via email to