# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=m2r
pkgver=0.2.1
pkgrel=11
pkgdesc="Markdown to reStructuredText converter"
arch=(any)
url="https://github.com/miyakogi/m2r"
license=('MIT')
depends=('python-mistune1' 'python-docutils')
makedepends=('python-setuptools')
checkdepends=('python-pygments' 'python-pytest-runner')
source=("https://github.com/miyakogi/m2r/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
        python310.patch
        docutils-0.19.patch)
sha512sums=('847f04538ee52f0b0a88cee9474ed889e8114a3a7b1fb221cdaa867ab70ca52f517250f2c8bbf795ae598c7b6614e6d03d9f6f05b7e3d56fb8087d63eb52f1bc'
            '3eeba63f27c0a4441948bfe3d55cf1db82ecc136a2ceafc054e68920f1da394df79d76c3fa8216effa516d1653f2bfda9f2f980cdca96d3f38468d18818c8bc1'
            '9e6398fedb9ee4a9274b5e78222466696da51411bf80709f59220bb37d4fedd9a87f03106771409c295522a8a3ca1126c51e104a0b530b346950a435776b4f64')

prepare() {
  cd m2r-$pkgver
  patch -Np1 -i ../python310.patch
  patch -p1 -i ../docutils-0.19.patch
}

build() {
  cd m2r-$pkgver
  python setup.py build
}

check() {
  cd m2r-$pkgver
  python setup.py pytest
}

package() {
  cd m2r-$pkgver
  python setup.py install --root="$pkgdir" --prefix=/usr --optimize=1
  install -D -m644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
