summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a4314d08905f1169053822bfeab6024ca492b3fb (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
# Maintainer: Daniel Bershatsky <bepshatsky@yandex.ru>
pkgname=python-chex
_pkgname=${pkgname#python-}
pkgver=0.1.86
pkgrel=1
pkgdesc="A library of utilities for helping to write reliable JAX code"
arch=('any')
url="https://github.com/google-deepmind/chex"
license=('Apache')
groups=('deepmind' 'jax')
depends=('python-absl'
         'python-jax>=0.4.16'
         'python-numpy'
         'python-toolz'
         'python-typing_extensions')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-cloudpickle' 'python-dm-tree' 'python-pytest')
source=("$_pkgname-$pkgver.tar.gz::https://github.com/google-deepmind/$_pkgname/archive/refs/tags/v$pkgver.tar.gz"
        'chex.diff')
sha256sums=('7fe6ea238e35c2b24e27f3c5eba6cffdc879dd9fdecb8c12f75de3668569e170'
            'SKIP')

prepare() {
    cd "$_pkgname-$pkgver"
    # There is no dependency on `dm-tree` in `chex`.
    sed -i '/\(dm[-_]tree\|setuptools\)/d' requirements/requirements.txt
    # https://github.com/google-deepmind/chex/issues/347
    patch -p1 -i../chex.diff
}

build() {
    python -m build -nw "$_pkgname-$pkgver"
}

check() {
    cd "$_pkgname-$pkgver"
    export PYTHONPATH=$PWD
    pytest -v -s chex
}

package() {
    cd "$_pkgname-$pkgver"
    python -m installer \
        --compile-bytecode 1 \
        --destdir $pkgdir \
        dist/$_pkgname-$pkgver-*.whl
}