summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 359375adf7bddd1d1f0bea48cd3e1760259a00c8 (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
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pip-api
pkgver=0.0.33
pkgrel=2
pkgdesc="An unofficial, importable pip API"
url="https://github.com/di/pip-api"
license=('Apache-2.0')
arch=('any')
depends=(
  'python'
  'python-packaging'
  'python-pyparsing'
  'python-pip'
  'python-tomli'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=('python-pytest-runner' 'python-pretend' 'python-virtualenv')

source=(
  "$pkgname-$pkgver.tar.gz::https://github.com/di/pip-api/archive/$pkgver.tar.gz"
  'skip-unsupported-test.patch'
)

sha512sums=(
  '4f711de7a05209b0aa57ef39fa1e507a171f8b807de0915fdacaef9b0a943e3ba03edb190d6b0a804c3a54e2575c501abe4ab3f27ad50b4b912c7703cb0144e3'
  '41e55d61912e6f010d1087f8883cc2ed1796caaf11a54be950afc5b409ad3ce1f99d7fa9980b83e6b1a4725f9fc402cc213a8f42d71e6f824f9a8fa0442c8d79'
)

prepare() {
  cd pip-api-$pkgver

  # Devendor
  sed -i \
    -e 's/from pip_api\._vendor\./from /' \
    -e 's/from pip_api\._vendor //' \
    pip_api/*.py tests/*.py
  rm -r pip_api/_vendor

  # Mark irrelevant failing test as xfail.
  # This workaround is permanent. Remove it only if upstream ever
  # removes or skips the affected test. For details, see the patch.
  patch -p1 < "${srcdir}/skip-unsupported-test.patch"
}

build() {
  cd pip-api-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd pip-api-$pkgver
  python -m pytest
}

package() {
  cd pip-api-$pkgver
  python -I -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}