summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 03c9a2a344c848d6f2d4d41e3485586aefeb96e1 (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
# Maintainer: Filip Andersson <filip@artifact.se>


_pkgname=pytm
pkgname='python-pytm-git'
pkgver=0.0.0.r0.g0000000
pkgrel=1
pkgdesc="A Pythonic framework for threat modeling."
arch=('any')
url=https://github.com/OWASP/"${_pkgname}"
license=('MIT')
depends=(
    'python>=3.10'
    'python-graphviz'
    'jre11-openjdk'
    'plantuml'
    'python-pydal-git'
)
makedepends=(
    'python-build'
    'python-installer'
    'python-wheel'
    'python-poetry'
    'python-pbs-installer'
    'python-httpx'
    'git'
)
optdepends=(
)
source=("${_pkgname}::git+https://github.com/OWASP/${_pkgname}.git")
sha256sums=('SKIP')

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git describe --tags --long 2>/dev/null \
        | sed 's/^v//;s/-/./g' \
        || printf "0.0.0.r%s.g%s" \
            "$(git rev-list --count HEAD)" \
            "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "${srcdir}/${_pkgname}"
}

build() {
    cd "${srcdir}/${_pkgname}"
    python -m build --wheel --no-isolation
}

package() {
    cd "${srcdir}/${_pkgname}"
    python -m installer --destdir="$pkgdir" dist/*.whl
    
    # Install license if it exists
    if [ -f LICENSE ]; then
        install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    elif [ -f COPYING ]; then
        install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
    fi
    
    # Install documentation
    if [ -f README.md ]; then
        install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
    fi
}

check() {
    cd "${srcdir}/${_pkgname}"
}