# Maintainer: gym603 _realname=keras pkgbase=mingw-w64-python-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}") pkgver=2.2.4 pkgrel=1 pkgdesc="Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. (mingw-w64)" arch=('any') url="http://keras.io/" license=('MIT') _archive=${_realname}-${pkgver} source=(${_archive}.tar.gz::https://github.com/keras-team/keras/archive/${pkgver}.tar.gz 0001-change-backend-to-theano.patch) sha256sums=('46F8E5BD66F778ABD8D5A62B3C3D749FBD41854176FCF0DF5258CF94C3FD1B28' '13CEDF9FD8636A3AC472671B8F07D118F6708BDD63CE3F3614923C18B35E3D7D') _deps=('numpy' 'scipy' 'six' 'yaml' 'h5py' 'keras_applications' 'keras_preprocessing' 'theano') makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools" "${MINGW_PACKAGE_PREFIX}-python2-setuptools") # Helper macros to help make tasks easier # apply_patch_with_msg() { for _patch in "$@" do msg2 "Applying ${_patch}" patch -b -p1 -i "${srcdir}/${_patch}" done } prepare() { cd "${srcdir}/${_archive}" apply_patch_with_msg \ 0001-change-backend-to-theano.patch } build() { cd "${srcdir}" rm -rf python{2,3}-build for builddir in python{2,3}-build; do cp -r ${_archive} ${builddir} pushd $builddir ${MINGW_PREFIX}/bin/${builddir%-build} setup.py build popd done } package_python3-keras() { depends=("${MINGW_PACKAGE_PREFIX}-python3" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}") cd "${srcdir}/python3-build" MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE" } package_python2-keras() { depends=("${MINGW_PACKAGE_PREFIX}-python2" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}") cd "${srcdir}/python2-build" MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE" } package_mingw-w64-i686-python2-keras() { package_python2-keras } package_mingw-w64-i686-python3-keras() { package_python3-keras } package_mingw-w64-x86_64-python2-keras() { package_python2-keras } package_mingw-w64-x86_64-python3-keras() { package_python3-keras }