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

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
}
