diff options
author | Moritz Schaefer | 2018-10-30 18:02:38 +0100 |
---|---|---|
committer | Moritz Schaefer | 2018-10-30 18:02:38 +0100 |
commit | 3d17e7032c73f8f22f55b71bbdecde7062036ed5 (patch) | |
tree | caaf8898d5a1297892fc1b850f816fe583a03915 /PKGBUILD | |
download | aur-python-eutils.tar.gz |
initial commit
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5860719d4379 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,103 @@ +# Maintainer: Moritz Schaefer + +export PIP_CONFIG_FILE=/dev/null +export PIP_DISABLE_PIP_VERSION_CHECK=true + +pkgname=python-eutils +epoch= +pkgver=0.4.1 +pkgrel=00 +pkgdesc='Structured Python interface to NCBI E-Utilities.' +arch=(any) +url=https://github.com/biocommons/eutils +license=(Apache) +depends=(python python-pytz python-requests python-lxml python-six) +## 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/05/25/226ee093ebe2533ed4f0be25896607ab3afce0de824293ddf8d2bc3d8621/eutils-0.4.1-py2.py3-none-any.whl) +md5sums+=(b0f9ad9c86c5f4f46c9946ca94546cec) +noextract=(eutils-0.4.1-py2.py3-none-any.whl) +source+=(LICENSE) +md5sums+=(e3fc50a88d0a364313df4b21ef20c29e) +_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" |