# Maintainer (AUR): Gordian Edenhofer <gordian.edenhofer@gmail.com>
# Contributor (AUR): Maarten van Gompel <proycon at anaproy dot nl>
# Contributor (AUR): Lex Black <autumn-wind at web dot de>
# Contributor (AUR): Dieter_be
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Luke Shumaker <lukeshu@lukeshu.com>

_pkgname=gensim
pkgbase=python-gensim
pkgname=('python-gensim' 'python2-gensim')
pkgver=3.7.1
pkgrel=1
pkgdesc="Python framework for fast Vector Space Modelling"
arch=('i686' 'x86_64')
license=('LGPL')
url="https://radimrehurek.com/gensim/"
makedepends=('python-setuptools' 'python-numpy' 'cython')
makedepends+=('python2-setuptools' 'python2-numpy' 'cython2')
source=("https://pypi.io/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
	"gensim-$pkgver-stdint_wrapper.h::https://raw.githubusercontent.com/RaRe-Technologies/gensim/$pkgver/gensim/models/stdint_wrapper.h") # https://github.com/RaRe-Technologies/gensim/pull/2367)
sha256sums=('ed845ac585f724ae1f40fdb517ed8ade822531f9bbcd1be4a599c2e86aff48a8'
            '4c5ae8ba815a06a15959374721e50c6b683962a2df13d561026ff11cebafc369')

prepare() {
	cp "${srcdir}/gensim-$pkgver-stdint_wrapper.h" "${srcdir}/${_pkgname}-${pkgver}/gensim/models/stdint_wrapper.h"
	cp -a "${srcdir}/${_pkgname}-${pkgver}"{,-py2}
}

build() {
	cd "${srcdir}/${_pkgname}-${pkgver}"
	python setup.py build

	cd "${srcdir}/${_pkgname}-${pkgver}-py2"
	python2 setup.py build
}

package_python-gensim() {
	depends=('python-numpy' 'python-scipy' 'python-six' 'python-smart_open')
	optdepends=("python-pyro: Usage in a distributed environment")

	cd "${srcdir}/${_pkgname}-${pkgver}"
	python setup.py install --root="${pkgdir}" --optimize=1
}

package_python2-gensim() {
	depends=('python2-numpy' 'python2-scipy' 'python2-six' 'python2-smart_open')
	optdepends=("python2-pyro: Usage in a distributed environment")

	cd "${srcdir}/${_pkgname}-${pkgver}-py2"
	python2 setup.py install --root="${pkgdir}" --optimize=1
}
