commit:     d255975625d71cc64630ff0b0332d90b0be85c64
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Tue Oct 22 14:39:19 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Tue Oct 22 14:39:19 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=d2559756

dev-python/questionary: new package, add 2.0.1

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 dev-python/questionary/Manifest                    |  1 +
 .../files/questionary-2.0.1-prompt-toolkit.patch   | 64 ++++++++++++++++++++++
 dev-python/questionary/metadata.xml                | 13 +++++
 dev-python/questionary/questionary-2.0.1.ebuild    | 31 +++++++++++
 4 files changed, 109 insertions(+)

diff --git a/dev-python/questionary/Manifest b/dev-python/questionary/Manifest
new file mode 100644
index 000000000..5a4a67add
--- /dev/null
+++ b/dev-python/questionary/Manifest
@@ -0,0 +1 @@
+DIST questionary-2.0.1.gh.tar.gz 350585 BLAKE2B 
ec8b617e2fadf1ac23dac6a1b770916ac18a4874c7fbf7c5c9645626ae46848de815d118c8bcc2da54479525045fe50d6edf7f3fa743bbc91d14528a3f941e51
 SHA512 
366baacbb0b1a16317ea164baf55c09f29580a0a818d24ece2cf2fc2f3f34362707f570b2b54638c10cb8f1ad5fb008a30a02bc4b017fad0c2845d6f739453f1

diff --git 
a/dev-python/questionary/files/questionary-2.0.1-prompt-toolkit.patch 
b/dev-python/questionary/files/questionary-2.0.1-prompt-toolkit.patch
new file mode 100644
index 000000000..2978ceb72
--- /dev/null
+++ b/dev-python/questionary/files/questionary-2.0.1-prompt-toolkit.patch
@@ -0,0 +1,64 @@
+Try to support prompt_toolkit >3.0.37
+
+Fixes: https://github.com/tmbo/questionary/issues/344
+
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -33,7 +33,7 @@ license = "MIT"
+ 
+ [tool.poetry.dependencies]
+ python = ">=3.8"
+-prompt_toolkit = ">=2.0,<=3.0.36"  # once 
https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1726 is fixed, 
this can be changed to ">=2.0,<4.0"
++prompt_toolkit = ">=2.0,<4.0"
+ 
+ [tool.poetry.group.docs]
+ optional = true
+diff --git a/tests/prompts/test_common.py b/tests/prompts/test_common.py
+index d6ce51e..b6bbe1b 100644
+--- a/tests/prompts/test_common.py
++++ b/tests/prompts/test_common.py
+@@ -1,8 +1,10 @@
++import asyncio
+ from unittest.mock import Mock
+ from unittest.mock import call
+ 
+ import pytest
+ from prompt_toolkit.document import Document
++from prompt_toolkit.input.defaults import create_pipe_input
+ from prompt_toolkit.output import DummyOutput
+ from prompt_toolkit.styles import Attrs
+ from prompt_toolkit.validation import ValidationError
+@@ -13,7 +15,6 @@ from questionary.prompts import common
+ from questionary.prompts.common import InquirerControl
+ from questionary.prompts.common import build_validator
+ from questionary.prompts.common import print_formatted_text
+-from tests.utils import execute_with_input_pipe
+ from tests.utils import prompt_toolkit_version
+ 
+ 
+@@ -72,7 +73,7 @@ def test_blank_line_fix():
+ 
+     ic = InquirerControl(["a", "b", "c"])
+ 
+-    def run(inp):
++    async def run(inp):
+         inp.send_text("")
+         layout = common.create_inquirer_layout(
+             ic, get_prompt_tokens, input=inp, output=DummyOutput()
+@@ -86,7 +87,15 @@ def test_blank_line_fix():
+             == 1000000000000000000000000000001
+         )
+ 
+-    execute_with_input_pipe(run)
++    if prompt_toolkit_version < (3, 0, 29):
++        inp = create_pipe_input()
++        try:
++            return asyncio.run(run(inp))
++        finally:
++            inp.close()
++    else:
++        with create_pipe_input() as inp:
++            asyncio.run(run(inp))
+ 
+ 
+ def test_prompt_highlight_coexist():

diff --git a/dev-python/questionary/metadata.xml 
b/dev-python/questionary/metadata.xml
new file mode 100644
index 000000000..3cb035804
--- /dev/null
+++ b/dev-python/questionary/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Anna</name>
+       </maintainer>
+       <stabilize-allarches/>
+       <upstream>
+               <remote-id type="github">tmbo/questionary</remote-id>
+               <remote-id type="pypi">questionary</remote-id>
+       </upstream>
+</pkgmetadata>

diff --git a/dev-python/questionary/questionary-2.0.1.ebuild 
b/dev-python/questionary/questionary-2.0.1.ebuild
new file mode 100644
index 000000000..78557ed8d
--- /dev/null
+++ b/dev-python/questionary/questionary-2.0.1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=poetry
+PYTHON_COMPAT=( python3_{11..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python library to build pretty command line user prompts"
+HOMEPAGE="
+       https://pypi.org/project/questionary/
+       https://github.com/tmbo/questionary
+"
+SRC_URI="https://github.com/tmbo/${PN}/archive/refs/tags/${PV}.tar.gz -> 
${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="dev-python/prompt-toolkit[${PYTHON_USEDEP}]"
+
+PATCHES=( "${FILESDIR}"/${PN}-2.0.1-prompt-toolkit.patch )
+
+distutils_enable_tests pytest
+
+distutils_enable_sphinx docs \
+       dev-python/sphinx-autodoc-typehints \
+       dev-python/sphinx-copybutton \
+       dev-python/sphinx-rtd-theme

Reply via email to