# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=cycler
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.10.0
pkgrel=1
pkgdesc="Composable style cycles"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('BSD')
url="https://github.com/matplotlib/cycler"
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-six")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-nose"
              "${MINGW_PACKAGE_PREFIX}-python-coverage")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/matplotlib/${_realname}/archive/v${pkgver}.tar.gz")
sha256sums=('b6d217635e03024196225367b1a438996dbbf0271bec488f00584f0e7dc15cfa')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python run_tests.py
}

package() {
  cd "${srcdir}/python-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --root="${pkgdir}" --prefix=$MINGW_PREFIX --optimize=1 --skip-build

  install -D -m644 LICENSE "${pkgdir}/$MINGW_PREFIX/share/licenses/python-cycler/LICENSE"
}
