summaryrefslogtreecommitdiff
path: root/pcr/python-py3dns/PKGBUILD
blob: e688b889882030dad561c6345ef5b289303354b8 (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
# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
# Maintainer (aur:python-pydns): Sebastien Leduc <sebastien@sleduc.fr>
# Contributor: Samed Beyribey <ras0ir AT eventualis DOT org>

pkgname=python-py3dns
_pkgname=${pkgname#python-}
pkgver=4.0.0
pkgrel=1
pkgdesc="A module for looking up DNS entries in Python applications"
arch=('any')
url="https://launchpad.net/${_pkgname}"
license=('custom:PSF-like')

makedepends=('python-build' 'python-installer' 'python-wheel' 'python-flit')

source=("https://launchpad.net/${_pkgname}/trunk/${pkgver}/+download/${_pkgname}-${pkgver}.tar.gz"{,.asc})
md5sums=('1dddc2621ced329a84a814eae1f92a39'
         'SKIP')
validpgpkeys=('E7729BFFBE85400FEEEE23B178D7DEFB9AD59AF1') # Donald Scott Kitterman

build() {
  cd "$_pkgname-$pkgver"
  python -m build --wheel --no-isolation
}

check() {
  if ! getent hosts parabola.nu >/dev/null; then
    # The tests require networking, which is disabled in libremakepkg
    # (for good reason).  But it's a bummer for these tests.
    # https://labs.parabola.nu/issues/3565
    return
  fi

  cd "$_pkgname-$pkgver"
  for tstfile in ./test.py tests/*; do
    echo "Running $tstfile..."
    case "$tstfile" in
      tests/test5.py) PYTHONPATH=. "$tstfile" parabola.nu;;
      *)              PYTHONPATH=. "$tstfile";;
    esac
  done
}

package() {
  _python_version=$(pacman -S --print-format='%v' python|cut -d- -f1|cut -d. -f1,2)
  depends=("python>=${_python_version}" "python<${_python_version%.*}.$(( ${_python_version##*.} + 1 ))")

  cd "$_pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir/usr/share/licenses/$pkgname"
  ln -s "$site_packages/${pkgname#python-}-$pkgver.dist-info/licenses/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}