summaryrefslogtreecommitdiff
path: root/dev-python/typer
diff options
context:
space:
mode:
authorLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2025-05-06 07:02:25 +0000
committerLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2025-05-06 07:02:25 +0000
commitbf2303e6bf93b4b9382690091cced410b34f6545 (patch)
tree07effdf0b0133c0db74babd0c79a8f9206bb098e /dev-python/typer
parent21482f5dabda855fbc5b2669b51199d9bb7da845 (diff)
downloadbaldeagleos-repo-bf2303e6bf93b4b9382690091cced410b34f6545.tar.gz
baldeagleos-repo-bf2303e6bf93b4b9382690091cced410b34f6545.tar.xz
baldeagleos-repo-bf2303e6bf93b4b9382690091cced410b34f6545.zip
Adding metadata
Diffstat (limited to 'dev-python/typer')
-rw-r--r--dev-python/typer/metadata.xml4
-rw-r--r--dev-python/typer/typer-0.15.3.ebuild93
2 files changed, 83 insertions, 14 deletions
diff --git a/dev-python/typer/metadata.xml b/dev-python/typer/metadata.xml
index 3fab47b124fa..8a81ebe4b659 100644
--- a/dev-python/typer/metadata.xml
+++ b/dev-python/typer/metadata.xml
@@ -10,5 +10,9 @@
<name>Proxy Maintainers</name>
</maintainer>
+ <use>
+ <flag name="rich">Rich text output via <pkg>dev-python/rich</pkg></flag>
+ <flag name="shell-detection">detect current shell with <pkg>dev-python/shellingham</pkg> for completions</flag>
+ </use>
<origin>gentoo-guru-overlay</origin>
</pkgmetadata> \ No newline at end of file
diff --git a/dev-python/typer/typer-0.15.3.ebuild b/dev-python/typer/typer-0.15.3.ebuild
index abb7e874f7f1..c6921119791c 100644
--- a/dev-python/typer/typer-0.15.3.ebuild
+++ b/dev-python/typer/typer-0.15.3.ebuild
@@ -1,27 +1,92 @@
-# Copyright 2025
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9,10,11,12,13} )
+DISTUTILS_USE_PEP517=pdm-backend
-DISTUTILS_USE_PEP517="hatchling"
+inherit distutils-r1 shell-completion pypi
-inherit distutils-r1 pypi
-
-DESCRIPTION="Typer, build great CLIs. Easy to code. Based on Python type hints."
-
-HOMEPAGE="https://typer.tiangolo.com/"
+DESCRIPTION="Build great CLIs. Easy to code. Based on Python type hints."
+HOMEPAGE="
+ https://typer.tiangolo.com/
+ https://github.com/tiangolo/typer
+ https://pypi.org/project/typer/
+"
+SRC_URI="$(pypi_sdist_url "${PN}" "${PV}")"
LICENSE="MIT"
SLOT="0"
-KEYWORDS="~amd64"
+KEYWORDS="~amd64 ~arm64"
-DEPEND="
- dev-python/shellingham[${PYTHON_USEDEP}]
- >=dev-python/click-8.0.0[${PYTHON_USEDEP}]
- >=dev-python/typing-extensions-3.7.4.3[${PYTHON_USEDEP}]
- dev-python/rich[${PYTHON_USEDEP}]
+IUSE="+rich shell-detection test"
+
+BDEPEND="
+ test? (
+ $(python_gen_cond_dep '
+ dev-python/coverage[${PYTHON_USEDEP}]
+ dev-python/shellingham[${PYTHON_USEDEP}]
+ ')
+ )
+"
+RDEPEND="
+ $(python_gen_cond_dep '
+ dev-python/click[${PYTHON_USEDEP}]
+ dev-python/typing-extensions[${PYTHON_USEDEP}]
+ rich? ( dev-python/rich[${PYTHON_USEDEP}] )
+ shell-detection? ( dev-python/shellingham[${PYTHON_USEDEP}] )
+ ')
"
-RDEPEND="${DEPEND}"
+distutils_enable_tests pytest
+
+src_test() {
+ export TERMINAL_WIDTH=3000
+ export _TYPER_FORCE_DISABLE_TERMINAL=1
+
+ distutils-r1_src_test "${@}"
+}
+
+src_compile() {
+ distutils-r1_src_compile "${@}"
+
+ local shell
+ for shell in bash zsh fish; do
+ typer_gencomp ${shell}
+ done
+}
+
+typer_get_comp() {
+ local COMPLETIONSDIR="${WORKDIR}/comp"
+ local shell="$1"
+
+ case "${shell}" in
+ bash) echo "${COMPLETIONSDIR}/${PN}" ;;
+ zsh) echo "${COMPLETIONSDIR}/_${PN}" ;;
+ fish) echo "${COMPLETIONSDIR}/${PN}.fish" ;;
+ *) die "unknown shell: ${shell}" ;;
+ esac
+}
+
+typer_gencomp() {
+ local COMPLETIONSDIR="${WORKDIR}/comp"
+ mkdir "${COMPLETIONSDIR}" 2> /dev/null
+ local shell="$1"
+
+ compfile="$(typer_get_comp "${@}")"
+
+ _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=1 python -m typer --show-completion "${shell}" |
+ sed 's/python -m //g ; s/_PYTHON _M //g ; s/python_m//g ; s/TYPER_COMPLETE/_TYPER_COMPLETE/' > "${compfile}" ||
+ die "failed to generate ${shell} completion"
+
+ einfo "generated completion script for ${shell}: ${compfile}"
+}
+
+src_install() {
+ distutils-r1_src_install "${@}"
+
+ dobashcomp "$(typer_get_comp bash)"
+ dozshcomp "$(typer_get_comp zsh)"
+ dofishcomp "$(typer_get_comp fish)"
+}