summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c38f1e0c31b9cdfa9a6ccb9e2665d7d3354a5870 (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
# Maintainer: Aseem Athale <athaleaseem@gmail.com>

_base=python-crfsuite
pkgname=${_base}-git
epoch=1
pkgver=0.9.10.r0.gf7c0165
pkgrel=3
pkgdesc="A python binding for crfsuite"
arch=('any')
url="https://github.com/scrapinghub/${_base}"
license=('MIT')
depends=('python')
makedepends=('python-build' 'python-wheel' 'python-installer' 'python-setuptools' 'cython' 'git')
source=("git+https://github.com/scrapinghub/python-crfsuite.git"
        "git+https://github.com/chokkan/crfsuite.git"
        "git+https://github.com/chokkan/liblbfgs.git")
sha512sums=("SKIP"
            "SKIP"
            "SKIP")
provides=('python-crfsuite')
conflicts=('python-crfsuite')

pkgver() {
  cd "${_base}"
  git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${_base}"
  cython pycrfsuite/_pycrfsuite.pyx --cplus -a -2 -I pycrfsuite

  git submodule init

  git config submodule.crfsuite/crfsuite.url "$srcdir/crfsuite"
  git config submodule.liblbfgs/liblbfgs.url "$srcdir/liblbfgs"

  git -c protocol.file.allow=always submodule update
  git -C "${srcdir}/${_base}" clean -dfx
}

build() {
  cd "${_base}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${_base}"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}