summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 24855311ba41ee3270885552f48bffb86db899f8 (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
# Maintainer : Daniel Bermond <dbermond@archlinux.org>

pkgname=python-srt-git
pkgver=3.5.2.r7.g1247ed7
pkgrel=1
pkgdesc='Tools and python library for parsing, modifying, and composing SRT files (git version)'
arch=('any')
url='https://github.com/cdown/srt/'
license=('MIT')
depends=('python')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-hypothesis' 'python-pytest')
provides=('python-srt')
conflicts=('python-srt' 'python-pysrt')
source=('python-srt'::'git+https://github.com/cdown/srt.git')
sha256sums=('SKIP')

pkgver() {
    git -C python-srt describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

build() {
    cd python-srt
    python -m build --wheel --no-isolation
}

check() {
    cd python-srt
    pytest
}

package() {
    python -m installer --destdir="$pkgdir" python-srt/dist/*.whl
    
    local _pyver
    _pyver="$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')"
    install -d -m755 "${pkgdir}/usr/share/licenses/${pkgname}"
    ln -s "../../../lib/python${_pyver}/site-packages/srt-${pkgver/.r*/}.dist-info/LICENSE" \
        "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}