# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Maintainer: Konstantin Gizdov (kgizdov) <arch@kge.pw>

pkgname=python-tensorflow-estimator
pkgver=2.15.0
pkgrel=1
pkgdesc="A high-level TensorFlow API that greatly simplifies machine learning programming"
url="https://github.com/tensorflow/estimator"
license=('APACHE')
arch=('any')
depends=('python-wrapt')
makedepends=('bazel' 'python-installer' 'python-setuptools' 'python-tensorflow' 'python-wheel')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/tensorflow/estimator/archive/v${pkgver}.tar.gz")
sha512sums=('129fe36ee63932b324d8ee77f917d4ded99be2e645e0884bd920bebf703b63889ed72b76b14fcc3aa8f9cfd0b465428d67067fcfc43f2c761a101ea56d574d04')

build() {
  cd estimator-${pkgver}

  bazel build //tensorflow_estimator/tools/pip_package:build_pip_package
  bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package "${srcdir}/estimator_pip"
}

check() {
  cd estimator-${pkgver}

  # Of course, upstream doesn't care about working tests...
  # Revisit this at some point.
  # bazel test //tensorflow_estimator/...
}

package() {
  cd estimator-${pkgver}

  WHEEL_PACKAGE=$(find "$srcdir"/estimator_pip -name "tensor*.whl")
  python -m installer --destdir="$pkgdir" $WHEEL_PACKAGE
}
