# Contributor: Runar Tenfjord < runar dot tenfjord at gmail dot com >

_realname=patsy
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.5.1
pkgrel=1
pkgdesc="A Python package for describing statistical models and for building design matrices (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/pydata/patsy"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python-numpy")
optdepends=("${MINGW_PACKAGE_PREFIX}-python-nose: needed for integrated test suite"
            "${MINGW_PACKAGE_PREFIX}-python-scipy: needed for spline-related functions")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://pypi.python.org/packages/source/p/patsy/${_realname}-${pkgver}.tar.gz")
sha256sums=('f115cec4201e1465cd58b9866b0b0e7b941caafec129869057405bfe5b5e3991')

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
}

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

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

  install -Dm644 "LICENSE.txt" \
  "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
