Date: Thursday, March 24, 2022 @ 14:50:08 Author: sangy Revision: 1174730
add pkg: python-hatch 0.23.1-1 Added: python-hatch/ python-hatch/PKGBUILD python-hatch/hatch_complete.sh python-hatch/hatch_complete.zsh python-hatch/repos/ python-hatch/trunk/ --------------------+ PKGBUILD | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ hatch_complete.sh | 21 +++++++++++++++++++ hatch_complete.zsh | 28 ++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) Added: python-hatch/PKGBUILD =================================================================== --- python-hatch/PKGBUILD (rev 0) +++ python-hatch/PKGBUILD 2022-03-24 14:50:08 UTC (rev 1174730) @@ -0,0 +1,54 @@ +# Maintainer: Santiago Torres-Arias <santiago @ usualplace> +# Contributor: Kaizhao Zhang <[email protected]> + +pkgname=python-hatch +pkgver=0.23.1 +pkgrel=1 +pkgdesc="A modern project, package, and virtual env manager" +arch=('any') +url="https://github.com/ofek/hatch" +license=('MIT' 'Apache') +depends=( + 'python' 'python-appdirs' 'python-atomicwrites' 'python-click' + 'python-colorama' 'python-coverage' 'python-pexpect' 'python-pip' + 'python-pytest' 'python-semver' 'python-setuptools' 'python-sortedcontainers' + 'python-toml' 'twine' 'python-userpath' 'python-virtualenv' 'python-wheel' +) + + +_name=${pkgname/python-/} +source=( + "https://files.pythonhosted.org/packages/source/${_name:0:1}/${_name}/${_name}-${pkgver}.tar.gz" + 'hatch_complete.sh' + 'hatch_complete.zsh' +) +sha256sums=('97ee540e74450c2ac1eabc678b258db7a1c2830a40409302a6a31ec3183ab559' + 'b87254c621719188907a2062b0aa3c4eb078088872d1de7d53d6a6d61a679c44' + 'a43679d72ebb7b5c029192519597eff835586d0b6ed9d1e3dfc93270b8720e71') + +build() { + cd "${srcdir}/${_name}-${pkgver}" + python setup.py build +} + +package() { + cd "${srcdir}/${_name}-${pkgver}" + python setup.py install --root="${pkgdir}/" --optimize=1 --skip-build + install -Dm644 README.rst "${pkgdir}/usr/share/doc/${pkgname}/README.rst" + install -Dm644 LICENSE-MIT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT" + install -Dm644 LICENSE-APACHE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-APACHE" + + cd "${srcdir}" + + # Tab completions. + # via https://github.com/ofek/hatch/issues/57 and + # https://click.palletsprojects.com/en/7.x/bashcomplete/ + + # Tab completion for Bash. + # Generated by `_HATCH_COMPLETE=source hatch > hatch_complete.sh` + install -Dm644 hatch_complete.sh "${pkgdir}/usr/share/bash-completion/completions/${_name}" + + # Tab completion for Zsh. + # Generated by `_HATCH_COMPLETE=source_zsh hatch > hatch_complete.zsh` + install -Dm644 hatch_complete.zsh "${pkgdir}/usr/share/zsh/site-functions/_${_name}" +} Added: python-hatch/hatch_complete.sh =================================================================== --- python-hatch/hatch_complete.sh (rev 0) +++ python-hatch/hatch_complete.sh 2022-03-24 14:50:08 UTC (rev 1174730) @@ -0,0 +1,21 @@ +_hatch_completion() { + local IFS=$' +' + COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ + COMP_CWORD=$COMP_CWORD \ + _HATCH_COMPLETE=complete $1 ) ) + return 0 +} + +_hatch_completionetup() { + local COMPLETION_OPTIONS="" + local BASH_VERSION_ARR=(${BASH_VERSION//./ }) + # Only BASH version 4.4 and later have the nosort option. + if [ ${BASH_VERSION_ARR[0]} -gt 4 ] || ([ ${BASH_VERSION_ARR[0]} -eq 4 ] && [ ${BASH_VERSION_ARR[1]} -ge 4 ]); then + COMPLETION_OPTIONS="-o nosort" + fi + + complete $COMPLETION_OPTIONS -F _hatch_completion hatch +} + +_hatch_completionetup; Added: python-hatch/hatch_complete.zsh =================================================================== --- python-hatch/hatch_complete.zsh (rev 0) +++ python-hatch/hatch_complete.zsh 2022-03-24 14:50:08 UTC (rev 1174730) @@ -0,0 +1,28 @@ +_hatch_completion() { + local -a completions + local -a completions_with_descriptions + local -a response + response=("${(@f)$( env COMP_WORDS="${words[*]}" \ + COMP_CWORD=$((CURRENT-1)) \ + _HATCH_COMPLETE="complete_zsh" \ + hatch )}") + + for key descr in ${(kv)response}; do + if [[ "$descr" == "_" ]]; then + completions+=("$key") + else + completions_with_descriptions+=("$key":"$descr") + fi + done + + if [ -n "$completions_with_descriptions" ]; then + _describe -V unsorted completions_with_descriptions -U -Q + fi + + if [ -n "$completions" ]; then + compadd -U -V unsorted -Q -a completions + fi + compstate[insert]="automenu" +} + +compdef _hatch_completion hatch;
