# 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.4.0
pkgrel=1
pkgdesc='Official assortment of Ansible collections'
arch=('any')
url='https://pypi.org/project/ansible/'
msys2_repository_url='https://github.com/ansible/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.3'
)
makedepends=(
  'python-setuptools'
  'python-build'
  'python-installer'
  'python-setuptools'
)
source=("https://pypi.python.org/packages/source/a/ansible/ansible-${pkgver}.tar.gz")
sha512sums=('9ee82f208760a39d13d9b530760a0c26e65f656756793e7955fbaa1d7c3e4a22b9d95b52f208cb15bf8eec5c0b19347b7f013c09fb08a37f8ca3a782d8da16d9')

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
}
