# Contributor: Dirk Stolle

_realname=sphinx
pkgname=python-${_realname}
pkgver=9.1.0
pkgrel=1
pkgdesc='Python documentation generator'
arch=('any')
url='https://www.sphinx-doc.org/'
msys2_repository_url='https://github.com/sphinx-doc/sphinx'
msys2_references=(
  'archlinux: python-sphinx'
  'cygwin: python-sphinx'
  'purl: pkg:pypi/sphinx'
)
license=('spdx:BSD-2-Clause')
depends=(
  'python-babel'
  'python-colorama'
  'python-docutils'
  'python-imagesize'
  'python-jinja'
  'python-packaging'
  'python-pygments'
  'python-requests'
  'python-roman-numerals'
  'python-snowballstemmer'
  'python-sphinx-alabaster-theme'
  'python-sphinxcontrib-applehelp'
  'python-sphinxcontrib-devhelp'
  'python-sphinxcontrib-htmlhelp'
  'python-sphinxcontrib-jsmath'
  'python-sphinxcontrib-qthelp'
  'python-sphinxcontrib-serializinghtml'
)
makedepends=(
  'python-build'
  'python-flit-core'
  'python-installer'
)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('7741722357dd75f8190766926071fed3bdc211c74dd2d7d4df5404da95930ddb')

build() {
  cp -r "${_realname/-/_}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "python-build-${MSYSTEM}"

  python -m installer --prefix=${MSYSTEM_PREFIX} --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE.rst "${pkgdir}${MSYSTEM_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
