summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ab3afb7c01678e8c93039f8e338919b2347e9cb (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
# Copy from https://gitlab.archlinux.org/archlinux/packaging/packages/python-xxhash/-/blob/3.2.0-2/PKGBUILD
# Maintainer: miryo <miryo@vcup.moe>

# Maintainer: Konstantin Gizdov <arch at kge dot pw>

_pyname=xxhash
pkgname="python-${_pyname}-git"
pkgver=v3.4.1.r0.g02791fe
pkgrel=1
pkgdesc='Python binding for xxHash'
arch=('x86_64')
url="https://github.com/ifduyue/${pkgname}"
depends=('python' 'xxhash')
makedepends=('git' 'python-setuptools-scm' 'python-build' 'python-installer' 'python-wheel')
license=('BSD')
conflicts=('python-xxhash')
provides=('python-xxhash')
source=("${pkgname}::git+https://github.com/ifduyue/python-xxhash.git#tag=v3.4.1")
sha512sums=('SKIP')

pkgver() {
  cd "${srcdir}/${pkgname}"
  git describe --tags --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  # link to xxHash
  export XXHASH_LINK_SO=1
}

build() {
  cd "${srcdir}/${pkgname}"
  python -m build --wheel --no-isolation
}

check() {
  cd "${srcdir}/${pkgname}"
  # name clash is preventing import, rename source temporarily
  # don't forget to rename back after running tests
  mv xxhash _noxxhash
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-${python_version}" python -m unittest discover -vs tests
  mv _noxxhash xxhash
}

package() {
  cd "${srcdir}/${pkgname}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}