commit:     9bfe6f7939cd96c638028b8401f06df9e5181eea
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 15 18:13:25 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 15 19:22:58 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bfe6f79

dev-util/maturin: install shell completion files

Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 ...eta1-r1.ebuild => maturin-1.0.0_beta1-r2.ebuild} | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/dev-util/maturin/maturin-1.0.0_beta1-r1.ebuild 
b/dev-util/maturin/maturin-1.0.0_beta1-r2.ebuild
similarity index 94%
rename from dev-util/maturin/maturin-1.0.0_beta1-r1.ebuild
rename to dev-util/maturin/maturin-1.0.0_beta1-r2.ebuild
index 2336baf2beae..35e06bbbae10 100644
--- a/dev-util/maturin/maturin-1.0.0_beta1-r1.ebuild
+++ b/dev-util/maturin/maturin-1.0.0_beta1-r2.ebuild
@@ -399,7 +399,7 @@ CRATES_TEST="
        windows_x86_64_msvc-0.42.0"
 DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( pypy3 python3_{9..11} )
-inherit cargo distutils-r1 edo flag-o-matic
+inherit bash-completion-r1 cargo distutils-r1 edo flag-o-matic toolchain-funcs
 
 DESCRIPTION="Build and publish crates with pyo3, rust-cpython and cffi 
bindings"
 HOMEPAGE="https://www.maturin.rs/";
@@ -462,6 +462,15 @@ src_configure() {
 
 python_compile_all() {
        use !doc || mdbook build -d html guide || die
+
+       if ! tc-is-cross-compiler; then
+               local maturin=target/$(usex debug{,} release)/maturin
+               ${maturin} completions bash > "${T}"/${PN} || die
+               ${maturin} completions fish > "${T}"/${PN}.fish || die
+               ${maturin} completions zsh > "${T}"/_${PN} || die
+       else
+               ewarn "shell completion files were skipped due to 
cross-compilation"
+       fi
 }
 
 python_test() {
@@ -485,4 +494,14 @@ python_test() {
 python_install_all() {
        dodoc Changelog.md README.md
        use doc && dodoc -r guide/html
+
+       if ! tc-is-cross-compiler; then
+               dobashcomp "${T}"/${PN}
+
+               insinto /usr/share/fish/vendor_completions.d
+               doins "${T}"/${PN}.fish
+
+               insinto /usr/share/zsh/site-functions
+               doins "${T}"/_${PN}
+       fi
 }

Reply via email to