# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>

pkgname=scons
pkgver=4.10.0
pkgrel=1
pkgdesc="Extensible Python-based build utility"
arch=('any')
url="https://scons.org/"
msys2_references=(
  "anitya: 4770"
  "purl: pkg:pypi/scons"
)
license=('spdx:MIT')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
)
source=("https://pypi.org/packages/source/${pkgname::1}/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        "0001-msysize.patch")
sha256sums=('61e2fc42e0e2c750105d61f26cc1dfebcae9f4103d3dc0e9aeb373016b0d208c'
            '67455ddb48cdd068daa6fb8c2cb0b35feaa0a64b0fb9bd0020d99b74ef399fd3')

prepare() {
  cd "${pkgname}-${pkgver}"

  patch -p1 -i "${srcdir}/0001-msysize.patch"
}

build() {
  cd "${pkgname}-${pkgver}"

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

package() {
  cd "${pkgname}-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
