# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>

_pkgname=MyST-Parser
pkgname=python-myst-parser
pkgver=4.0.1
pkgrel=3
pkgdesc='An extended commonmark compliant parser, with bridges to docutils/sphinx'
arch=('any')
url='https://github.com/executablebooks/MyST-Parser'
license=('MIT')
depends=('python' 'python-docutils' 'python-jinja' 'python-markdown-it-py' 'python-mdit_py_plugins' 'python-pygments' 'python-sphinx' 'python-yaml')
optdepends=('python-linkify-it-py: linkify support')
makedepends=('python-build' 'python-installer' 'python-flit-core' 'python-wheel')
checkdepends=('python-beautifulsoup4' 'python-linkify-it-py' 'python-pytest' 'python-pytest-param-files' 'python-pytest-regressions' 'python-sphinx-pytest')
source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
         fix-tests.patch)
sha512sums=('40bdad9abb84cda3c77303dd7ad766c77df43bca11c787812007f2399525fe955201b09495079a88973ada3e87102c95eeec2cba6d2be89f6b61d3c9df57bfae'
            '3358704f412a55baf16d184b35560251c27ae0ffa83a66a8b229194125ab89e610e4208241a81fabebcf3ae5a602909de917df9c740ba83aa76e3962f8ff9b43')

prepare() {
  cd $_pkgname-$pkgver
  patch -p1 -i ../fix-tests.patch
}

build() {
  cd $_pkgname-$pkgver

  python -m build -wn
}

check() {
  cd $_pkgname-$pkgver

  python -m pytest \
    -k 'not test_sphinx_builds and not fixtures and not test_myst_config and not test_myst_refs' \
    --disable-warnings
}

package() {
  cd $_pkgname-$pkgver

  python -m installer -d "$pkgdir" dist/*.whl

  install -Dm 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

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