# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=python-feedgen
pkgver=1.0.0
pkgrel=3
pkgdesc='Python module to generate ATOM feeds, RSS feeds and Podcasts'
url='https://lkiesow.github.io/python-feedgen'
arch=('any')
license=('BSD')
depends=('python' 'python-dateutil' 'python-lxml')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-sphinx' 'python-wheel')
source=(https://github.com/lkiesow/python-feedgen/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz
        sphinx8-fix.patch)
sha512sums=('f21704f7f4714e51c9b7b1d98f71db041426e01039f4d85439ee0623b77575293f3efd6fdb7b6609f67e0a868863b15169f91cef3a3c16542182ecf9409eb524'
            'ae4630c1b76e5f6d6ddedbeb8aa5f249971664a273a2f4fe3375f4c7bcb78ff20dd7d8d0255a324c919f4dff38a3de2e88b450db493270989b0545ed73ef1af7')
b2sums=('e7594c3665555d79772afd0191089d846f294580259ec56829b6cc5a52c5de70b8e3d186e8d865e88ffa5bb52b7a2038c49e332b362de2670a67b6c28d7b8815'
        'c6001f97ff0b2dce9239300af8b936cf2e9079d4ed162d7f00d52ca4db5c7f1733f74a8eed7e68cffd140a0cc990b45fc84091ddd1be448f6c1dcf73bafbe878')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 -i ${srcdir}/sphinx8-fix.patch
}

build() {
  cd ${pkgname}-${pkgver}
  python -m build --wheel --no-isolation
  make -j1 -C doc man text
}

check() {
  cd ${pkgname}-${pkgver}
  python -m unittest discover tests
}

package() {
  cd ${pkgname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 readme.rst SECURITY.rst  -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 license.bsd license.lgpl -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r doc/_build/text/* "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 doc/_build/man/pyFeedGen.tex.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
}

# vim: ts=2 sw=2 et:
