summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7b53f81d7bb10e6fb5e34ee0cc24403ea5dc977f (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:  Vitalii Kuzhdin <vitaliikuzhdin@gmail.com>

_pypiname="pyriemann"
pkgname="python-${_pypiname}"
pkgver=0.12
pkgrel=2
pkgdesc="Machine learning for multivariate data through the Riemannian geometry of positive definite matrices in Python"
arch=(
  'any'
)
url="https://pyriemann.readthedocs.org"
_url="https://github.com/pyRiemann/pyRiemann"
license=(
  'BSD-3-Clause'
)
depends=(
  'python>=3.9'
  'python-numpy>=1.25.0'
  'python-scipy'
  'python-scikit-learn>=0.24'
  'python-array-api-compat>=1.11'
  'python-array-api-extra>=0.6'
  'python-joblib'
  'python-matplotlib'
)
checkdepends=(
  'python-pytest'
  'python-pytorch'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
)
optdepends=(
  'python-pytorch: PyTorch tensors'
)
_pkgsrc="${_url##*/}-${pkgver}"
source=(
  "python-${_pkgsrc}.tar.gz::${_url}/archive/refs/tags/v${pkgver}.tar.gz"
)
sha256sums=('487ce591454ad82f3b2fcbf7f54d44efd3669f08dfef895f7b365b921071679b')

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

check() {
  cd "${srcdir}/${_pkgsrc}"
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -P -m pytest
}

package() {
  local site_packages="$(python -c "import site; print(site.getsitepackages()[0])")"

  cd "${srcdir}/${_pkgsrc}"
  python -m installer --destdir="${pkgdir}" dist/*.whl

  install -vDm644 "README.md" -t "${pkgdir}/usr/share/doc/${pkgname}"

  install -vd "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -vsf "${site_packages}/${_pypiname//-/_}-${pkgver}.dist-info/licenses/LICENSE" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}