summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 07aeef4b8cf8083afb35af7f374c8864be58da65 (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: Renato Caldas <renato@calgera.com>
# Maintainer: Carlos Aznarán <caznaranl@uni.pe>
pkgname=('python-fenics-ufl-git')
pkgdesc='UFL - Unified Form Language'
pkgver=2023.2.0.dev0_r3539.9e120c6
pkgrel=3
arch=('any')
url='https://fenicsproject.org'
license=('MIT')
depends=('python-numpy')
makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest')
optdepends=('python-colorama: for ufl2unicode color formating'
            'python-scipy: for evaluating bessel functions')
conflicts=('python-fenics-ufl')
source=('git+https://github.com/FEniCS/ufl')
sha512sums=('SKIP')

pkgver()  {
    cd "$srcdir/ufl"
    # The main branch unfortunately has no meaningful tags
    printf "%s_r%s.%s" "$(sed -n -e 's/^version *= *\(.*\)/\1/p' setup.cfg)" \
        "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
    git -C "${srcdir}/ufl" clean -dfx
}

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

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

package() {
    cd "$srcdir/ufl"
    python -m installer --destdir="$pkgdir" dist/*.whl
    find "$pkgdir" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
    install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgbase/LICENSE"
}