# Template file for 'aws-cli'
pkgname=aws-cli
version=1.46.0
revision=1
build_style=python3-module
hostmakedepends="python3-setuptools"
depends="groff python3-botocore python3-s3transfer python3-colorama
 python3-rsa python3-yaml python3-docutils python3-jsonschema
 python3-dateutil python3-jmespath python3-urllib3"
checkdepends="$depends python3-pytest"
short_desc="Universal Command Line Interface for Amazon Web Services"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0"
homepage="https://github.com/aws/aws-cli"
distfiles="https://github.com/aws/aws-cli/archive/${version}.tar.gz"
checksum=38a1e346180b46cef51beec401720de92b23136d391effdea3f5fc9f8436b530

pre_check() {
	# Upstream test harness bug. Botocore is vendored.
	# Void's python3-botocore worked around it the same way.
	rm -r tests/functional/botocore/leak
}

do_check() {
	# integration tests want aws credentials, have some other issues not worth fixing
	PATH=$PWD/bin:$PATH PYTHONPATH=$PWD python3 -m pytest tests/unit tests/functional
}

post_install() {
	vinstall bin/aws_bash_completer 644 usr/share/bash-completion/completions aws
	vinstall bin/aws_zsh_completer.sh 644 usr/share/zsh/site-functions _aws
	rm "${DESTDIR}/usr/bin/aws_bash_completer"
	rm "${DESTDIR}/usr/bin/aws_zsh_completer.sh"
	rm "${DESTDIR}/usr/bin/aws.cmd"
}
