summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5d0be362fec6ca75aff306bef4fd8c7425326294 (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
# Maintainer: Jiachen Yang <farseerfc@gmail.com>

pkgname=suplemon
pkgver=0.2.0
pkgrel=3
pkgdesc='Console text editor with multi cursor support.'
arch=(any)
url=https://github.com/richrd/suplemon/
license=(MIT)
depends=(python python-pygments python-wcwidth)
makedepends=(python-pip)
optdepends=(
'python-pygments: For support for syntax highlighting over 300 languages.'
'flake8: For showing linting for Python files.'
'xsel: For system clipboard support on X Window (Linux).'
)
source=(https://pypi.python.org/packages/ee/3a/d71a82a5ff32157249875914f0aa1c70cee3796e689cd9ccb05f75c5998b/Suplemon-0.1.63.tar.gz)
sha512sums=('116c37826367e17fbb298dcf7fb51689e9b75bfa5745bbc084b975d95c0957f5eb15a1db0fe7d7b0ac563db381a94b57df93ae8de16c68603352e1e6b9f37706')

_first_source() {
    echo " ${source_i686[@]} ${source_x86_64[@]} ${source[@]}" |
        tr -s ' ' | tail -c+2 | cut -d' ' -f1
}

_dist_name() {
    basename "$(_first_source)" |
      sed 's/\(\.tar\.gz\|\.tgz\|\.tar\.bz2\|\.zip\|\.git\)$//'
}


build() {
    cd "$srcdir/$(_dist_name)"
    # See Arch Wiki/PKGBUILD/license.
    # Get the first filename that matches.
    local test_name
    if [[ ${license[0]} =~ ^(BSD|MIT|ZLIB|Python)$ ]]; then
        for test_name in LICENSE LICENSE.txt license.txt COPYING.md COPYING.rst COPYING.txt COPYRIGHT; do
            if cp "$srcdir/$(_dist_name)/$test_name" "$srcdir/LICENSE" 2>/dev/null; then
                break
            fi
        done
    fi
    # Build the wheel (which can fail) only after fetching the license.
    pip wheel -v --no-deps --wheel-dir="$srcdir" \
        --global-option=build --global-option=-j"$(nproc)" . ||
        true
}


package() {
    cd "$srcdir"
    # pypa/pip#3063: pip always checks for a globally installed version.
    pip --quiet install --root="$pkgdir" --no-deps --ignore-installed \
        "$(ls ./*.whl 2>/dev/null || echo ./"$(_dist_name)")"
}