# Maintainer: Jiachen Yang 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)")" }