summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: be334a5eb2dd7f87ffb48cc046735d35e01805b4 (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
# Maintainer: lestb <tkhdlstfl dot l plus aur at gmail dot com>

_pkgname=PyHamcrest
pkgbase=${_pkgname,,}
pkgname=(python{2,}-hamcrest-git)
pkgver=1.8.0.r5.gf2786ca
pkgrel=1
pkgdesc='A framework for writing matcher objects, allowing you to declaratively define "match" rules'
arch=('any')
url="https://github.com/hamcrest/PyHamcrest"
license=('BSD')
makedepends=(python{2,}-setuptools)
source=("git+https://github.com/hamcrest/${_pkgname}.git")
md5sums=('SKIP')

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

build() {
    for pybin in python python2; do
        _dir="${srcdir}/${pybin}-${_pkgname}-${pkgver}"
        mkdir -p "${_dir}"
        cd "${_dir}"
        cp -r "${srcdir}/${_pkgname}-${pkgver}"/. .
        ${pybin} setup.py build
    done
}

_package() {
    pybin=$1
    depends=(${pybin})
    cd "${srcdir}/${pybin}-${_pkgname}-${pkgver}"
    ${pybin} setup.py install --root="${pkgdir}" --optimize=1
    install -D -m644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

for _name in "${pkgname[@]}"; do
    _splitname=(${_name//-/ }) # For retriving the python version needed
    eval "package_${_name}() { _package ${_splitname[0]}; }"
done