summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2f7976a0d841db5186a7e2c206ed0e619582f2fb (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
68
69
70
71
# Maintainer: Manuel Wiesinger <m {you know what belongs here} mmap {and here} at>
# Contributor: Colin Unger <mastakata 3 at yahoo dot com>

_pyname=pyvex
_basename=python-$_pyname
pkgname=$_basename-git
pkgdesc="Python bindings for Valgrind's VEX IR"
url="https://github.com/angr/pyvex"
pkgver=9.2.129.dev0.r1140.10d953f
pkgrel=4
arch=('x86_64')
depends=(
    'glibc'
    'python>=3.10'
    'python-bitstring'
    'python-cffi'
)
makedepends=(
    'git'
    'python-build'
    'python-installer'
    'python-myst-parser'
    'python-setuptools'
    'python-sphinx-autodoc-typehints'
    'python-wheel'
)
checkdepends=('python-pytest')
provides=($_basename)
conflicts=($_basename)
license=('BSD-2-Clause')
source=("$pkgname::git+https://github.com/angr/pyvex.git")
b2sums=('SKIP')

pkgver() {
    cd $srcdir/$pkgname

    # Versions are orphaned branches with tags ...
    _version=$(grep -e '^__version__' $_pyname/__init__.py  | cut -f 2 -d '"')
    rev_num="$(git rev-list --count HEAD)"
    last_commit="$(git rev-parse --short HEAD)"
    echo "${_version}.r${rev_num}.${last_commit}"
}

prepare() {
    git -C $srcdir/$pkgname clean -dfx

    cd $srcdir/$pkgname
    git submodule update --init --filter=tree:0 --recursive
}

check() {
    cd $srcdir/$pkgname
    PYTHONPATH=build/lib pytest
}

build() {
    cd $srcdir/$pkgname

    python -m build --wheel --no-isolation
    make man -C docs
}

package() {
    provides+=($_basename=${pkgver%\.r[0-9]*})

    cd $srcdir/$pkgname

    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -Dm644 docs/_build/man/pyvex.1 -t "${pkgdir}/usr/share/man/man1"
}