summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3341fd9d6fc89617e1f83e865abad1974af85842 (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
# Maintainer: Gesh <gesh@gesh.uni.cx>

pkgname='python-citeproc-py'
_module='citeproc-py'
pkgver='0.8.2'
pkgrel=1
pkgdesc="Citations and bibliography formatter"
url="https://github.com/brechtm/citeproc-py"
depends=('python' 'python-lxml')
checkdepends=('python-nose')
makedepends=(
    'git'
    'python-setuptools'
    'python-build' 'python-installer' 'python-wheel'
    'rnc2rng'
)
license=('BSD-2-Clause-Views')
arch=('any')
source=("$pkgname::git+${url}.git#tag=v$pkgver")
sha256sums=('c4ace67054888cdaecaf282c6cf05ea6784b6f02c400c34d312cf7b609a5dd9a'
            'SKIP'
            'SKIP')

declare -A _submods
_submods['citeproc/data/schema']='schema'
source+=(schema::git+https://github.com/citation-style-language/schema.git)
_submods['citeproc/data/locales']='locales'
source+=(locales::git+https://github.com/citation-style-language/locales.git)

prepare() {
    cd "$pkgname"

    if ! sha256sum -c \
        <<< '304b09a991a593fc142db1932f38da252e2a8f0eef4cb5887ed9f5c6cafcb5e1  .gitmodules'
    then
        msg "$pkgname-$pkgver/.gitmodules differs from expectation"
        msg 'Check it against the submodule list in PKGBUILD'
        exit 1
    fi

    git submodule init
    for _mod in "${_submods[@]}"; do
        git config submodule."$_mod".url "$srcdir/${_submods[$_mod]}"
    done
    # See https://bugs.archlinux.org/task/76255 for why this is safe
    git -c protocol.file.allow=always submodule update
}

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

check() {
    cd "$pkgname"
    nosetests
}

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