summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 128a78129f94d70a96daec923b33316a2a83c126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Maintainer: Jakub Klinkovský <lahwaacz at archlinux dot org>

_name=mwparserfromhell
pkgname=python-mwparserfromhell-git
pkgver=0.7.1
pkgrel=1
pkgdesc="A Python parser for MediaWiki wikicode"
arch=(x86_64)
url="https://github.com/earwig/mwparserfromhell"
license=(MIT)
depends=(
  glibc
  python
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-setuptools-scm
  python-wheel
)
checkdepends=(
  python-pytest
)
conflicts=(${pkgname%-git})
provides=(${pkgname%-git}=${pkgver})
source=(
  git+https://github.com/earwig/mwparserfromhell.git
)
sha256sums=('SKIP')

pkgver() {
  cd $_name
  git describe --tags --always | sed 's|^v||;s|\([^-]*-g\)|r\1|;s|-|.|g'
}

build() {
  cd $_name
  python -m build --wheel --no-isolation
}

check() {
  cd $_name
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest
}

package() {
  cd $_name
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}