Created
December 15, 2020 09:45
-
-
Save bugnano/c0dd54d89635f25b039fbae61c484deb to your computer and use it in GitHub Desktop.
PKGBUILD file for packaging fuzzyfinder for Arch Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Unknown Packager | |
export PIP_CONFIG_FILE=/dev/null | |
export PIP_DISABLE_PIP_VERSION_CHECK=true | |
pkgname=python-fuzzyfinder | |
epoch= | |
pkgver=2.1.0 | |
pkgrel=00 | |
pkgdesc='Fuzzy Finder implemented in Python.' | |
arch=(any) | |
url=https://github.com/amjith/fuzzyfinder | |
license=(BSD) | |
depends=(python ) | |
## EXTRA_DEPENDS ## | |
makedepends=(python-pip) | |
checkdepends=() | |
provides=() | |
conflicts=(${provides%=*}) # No quotes, to avoid an empty entry. | |
source=(PKGBUILD_EXTRAS) | |
md5sums=(SKIP) | |
source+=(https://files.pythonhosted.org/packages/6c/80/e23249f1119435d00d0a226debbb0390de4b6ad456c1939de94512b946c8/fuzzyfinder-2.1.0-py2.py3-none-any.whl) | |
md5sums+=(3fc40d44f39c222b2b856e6633562c66) | |
noextract=(fuzzyfinder-2.1.0-py2.py3-none-any.whl) | |
source+=(LICENSE) | |
md5sums+=(c7f8a8a2a0581da1a5072d58a13444b2) | |
_first_source() { | |
echo " ${source_i686[@]} ${source_x86_64[@]} ${source[@]}" | | |
tr ' ' '\n' | grep -Pv '^(PKGBUILD_EXTRAS)?$' | head -1 | |
} | |
if [[ $(_first_source) =~ ^git+ ]]; then | |
provides+=("${pkgname%-git}") | |
conflicts+=("${pkgname%-git}") | |
fi | |
_is_wheel() { | |
[[ $(_first_source) =~ \.whl$ ]] | |
} | |
_dist_name() { | |
basename "$(_first_source)" | | |
sed 's/\(\.tar\.gz\|\.tgz\|\.tar\.bz2\|\.zip\|\.git\)$//' | |
} | |
if [[ $(_first_source) =~ ^git+ ]]; then | |
_pkgver() { | |
( set -o pipefail | |
cd "$srcdir/$(_dist_name)" | |
git describe --long --tags 2>/dev/null | | |
sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' || | |
printf "r%s.%s" \ | |
"$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | |
) | |
} | |
pkgver() { _pkgver; } | |
fi | |
_build() { | |
if _is_wheel; then return; fi | |
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 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 we allow to fail) only after fetching the license. | |
/usr/bin/pip wheel -v --no-deps --wheel-dir="$srcdir" \ | |
--global-option=--no-user-cfg \ | |
--global-option=build --global-option=-j"$(nproc)" . || | |
true | |
} | |
build() { _build; } | |
_check() { | |
# Define check(), possibly using _check as a helper, to run the tests. | |
# You may need to call `python setup.py build_ext -i` first. | |
if _is_wheel; then return; fi | |
cd "$srcdir/$(_dist_name)" | |
/usr/bin/python setup.py -q test | |
} | |
_package() { | |
cd "$srcdir" | |
# pypa/pip#3063: pip always checks for a globally installed version. | |
/usr/bin/pip --quiet install --root="$pkgdir" \ | |
--no-deps --ignore-installed --no-warn-script-location \ | |
"$(ls ./*.whl 2>/dev/null || echo ./"$(_dist_name)")" | |
if [[ -f LICENSE ]]; then | |
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" | |
fi | |
} | |
package() { _package; } | |
. "$(dirname "$BASH_SOURCE")/PKGBUILD_EXTRAS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment