# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Contributor: Thomas Böhler <witcher@wiredspace.de>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=ansible-core
_pkgname=${pkgname/-/_}
pkgver=2.18.6
pkgrel=0
pkgdesc="core components of ansible: A configuration-management, deployment, task-execution, and multinode orchestration framework"
url="https://ansible.com"
options="!check" # for now
arch="noarch"
license="GPL-3.0-or-later"
depends="
	py3-cryptography
	py3-jinja2
	py3-packaging
	py3-paramiko
	py3-resolvelib
	py3-yaml
	python3
	"
makedepends="py3-docutils py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
# tarball is named "ansible_core" instead of "ansible-core" since 2.16.6
source="$pkgname-$pkgver.tar.gz::https://pypi.python.org/packages/source/a/ansible-core/ansible_core-$pkgver.tar.gz
	resolvelib.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="ansible-base"

build() {
	gpep517 build-wheel --wheel-dir .dist --output-fd 3 3>&1 >&2
	python3 packaging/cli-doc/build.py man --output-dir man
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer --destdir="$pkgdir" .dist/*.whl

	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname/
	install -Dm644 man/ansible*1 -t "$pkgdir"/usr/share/man/man1/
}
sha512sums="
55a54bfa5e0a2458672856cd5a074799f4e3cb25160daf12902118bd8f1473214b4e6daea78264c20729a82be3524ef3188235287e0c3050c9b0d42031831502  ansible-core-2.18.6.tar.gz
d26b740a3fcfc0553424ef577cd55c22d037cd7c9c10d77a2695422b7cd29e610fc6ae2049578784685a2b35874697be42e7472cdb820141487c72fc7a1a04dc  resolvelib.patch
"
