# 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=12.2.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.19.4'
)
makedepends=(
  'python-setuptools'
  'python-build'
  'python-installer'
  'python-setuptools'
)
source=("https://pypi.python.org/packages/source/a/ansible/ansible-${pkgver}.tar.gz")
sha512sums=('714e146a49385c3028f50b392c97759ea2660f2caa20a9baa7fae582e056b69b6cacf7af702adf6d77428532c58f45ec47815bd9979a4260eb9ab6762411b70f')

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
}
