summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5888a7595f182dd3fec54e0d266f8c3b578fcfb8 (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
# Maintainer: Groctel <aur@taxorubio.com>
# shellcheck disable=SC2034,SC2154,SC2164

_name=glcontext

pkgname=python-glcontext
pkgver=3.0.0
pkgrel=1
pkgdesc="A library providing OpenGL implementation for ModernGL on multiple platforms."

arch=("any")
license=("MIT")
url="https://github.com/moderngl/glcontext"

source=("$url/archive/refs/tags/$pkgver.tar.gz")
sha512sums=('dc38b4f019d939c619d0981468f84fae72d8958a3e139901ba0866a6c0e6ffa35f566fcd0061cd9ad89dd20881ab9b84da8e9913c1944f70565457775e90bc26')

depends=(
    "libx11"
    "egl-wayland"
    "python"
    "python-psutil"
)
makedepends=(
    "python-build"
    "python-installer"
    "python-setuptools"
    "python-wheel"
)
checkdepends=(
    "python-pytest"
)

build () {
    cd "$srcdir/$_name-$pkgver" || exit
    python -m build --wheel --no-isolation
}

check () {
    cd "$srcdir/$_name-$pkgver"

    if echo "$XDG_SESSION_TYPE" | grep -iq "x11"; then
        python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
        PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest
    else
        echo "Tests only work on X11 sessions. Skipping..."
    fi
}

package () {
    cd "$srcdir/$_name-$pkgver" || exit
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$_name/LICENSE"
}