# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=oslo-i18n
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=5.0.1
pkgrel=1
pkgdesc="Oslo i18n library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://pypi.python.org/pypi/oslo.i18n/'
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-python" 
         "${MINGW_PACKAGE_PREFIX}-python-six"
         "${MINGW_PACKAGE_PREFIX}-python-pbr"
         "${MINGW_PACKAGE_PREFIX}-python-babel")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/openstack/oslo.i18n/archive/${pkgver}.tar.gz")
sha512sums=('342d5a53503a10ddbc606adc9d633044e604acd45dfe3a424c24cfb70b0c46c3536ff8f05683d51dd97dc2a29bb5d910ccb881c62d2bbc0553ba1ed6ff04ae72')

prepare() {
  cd "${srcdir}/oslo.i18n-${pkgver}"

  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
  # Set version for python_pbr
  export PBR_VERSION=$pkgver
}

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

check() {
  cd "${srcdir}/oslo.i18n-${pkgver}"
  ${MINGW_PREFIX}/bin/python setup.py check
}

package() {
  cd "${srcdir}/oslo.i18n-${pkgver}"

  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
}
