summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d0b062b498b2020805ef070347c2ee9801f7471b (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Maintainer: rumpelsepp <stefan at rumpelsepp dot org>

pkgname=python-msgspec
_pkgname=${pkgname#python-}
pkgver=0.18.6
_commit=9ed5e0d4f6e47e6f520835605bb647f234e7f6f3
pkgrel=3
pkgdesc="A fast and friendly JSON/MessagePack library, with optional schema validation"
arch=(x86_64)
url="https://github.com/jcrist/msgspec"
license=(BSD-3-Clause)
depends=(
  glibc
  python
  python-attrs
  python-typing_extensions
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-msgpack
  python-pytest
)
optdepends=(
  'python-tomli-w: for TOML support'
  'python-tomli: for TOML support'
  'python-yaml: for YAML support'
)
source=("git+$url.git#commit=$_commit")
sha256sums=('89d22370c834872112030e7cc84f2aaad1525ad72db43f6d2dbdb316f1a1d3cb')

pkgver() {
  cd "$_pkgname"

  git describe --tags
}

build() {
  cd "$_pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname"

  rm -rf tmp_install
  python -m installer --destdir=tmp_install dist/*.whl

  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  export PYTHONPATH="$PWD/tmp_install/$site_packages"
  pytest tests/
}

package() {
  cd "$_pkgname"

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

  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}