# Maintainer: Alexandre Ferreira <contact@alexjorgef.com>

pkgname=ansible
# Note: When packaging a new version of ansible, bump version of ansible-core in
# depends, if required.
pkgver=13.1.0
pkgrel=1
pkgdesc='Official assortment of Ansible collections'
arch=('any')
url='https://pypi.org/project/ansible/'
msys2_references=(
  "cpe: cpe:/a:ansible:ansible"
  "cpe: cpe:/a:redhat:ansible"
  "cpe: cpe:/a:redhat:ansible_engine"
  "purl: pkg:pypi/ansible"
)
license=('spdx:GPL-3.0-or-later')
depends=(
  'python'
  # Bump the version of ansible-core at least whenever a new major version of
  # ansible is packaged / released. Check the ansible release notes to get the
  # corresponding version of ansible-core. It usually has a statement like
  # "Ansible x.y.z depends on ansible-core a.b.c" in it.
  'ansible-core>=2.20.1'
)
makedepends=(
  'python-setuptools'
  'python-build'
  'python-installer'
  'python-setuptools'
)
source=("https://pypi.python.org/packages/source/a/ansible/ansible-${pkgver}.tar.gz")
sha512sums=('2e7abd85b44d48ea756c65906811c9fa5519ce5d9ecaca71c718446a52dfc3dff97597d048f071ca820ea606ee2de670e8a0746717f95e2ce636db06273b3544')

build() {
  cd ansible-${pkgver}

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd ansible-${pkgver}

  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -Dm644 COPYING "${pkgdir}"/usr/share/doc/${pkgname}/COPYING
}
