summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d0199c43fa873e55281a962024aa2eeee74858be (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
67
68
69
70
71
72
73
74
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor: David Runge <dvzrv@archlinux.org>

pkgname=python-fire-git
_gitpkgname=fire
pkgver=0.7.0.r15.gdba7e1d
pkgrel=1
pkgdesc='A library for automatically generating command line interfaces'
arch=('any')
url="https://github.com/google/python-fire"
license=('Apache-2.0')
depends=(
  'python'
  'python-termcolor'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=(
  'python-hypothesis'
  'python-levenshtein'
  'python-pytest'
)
provides=("python-fire=${pkgver}")
conflicts=('python-fire')

source=(
  "${_gitpkgname}::git+https://github.com/google/python-fire.git"
)

sha512sums=(
  'SKIP'
)

pkgver() {
  cd "${_gitpkgname}"
  git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

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

check() {
  cd "${_gitpkgname}"
  PYTHONPATH=build pytest
}

package() {
  local _site_packages

  cd "${_gitpkgname}"

  echo >&2 'Packaging the wheel'
  python -I -m installer --destdir="${pkgdir}" dist/*.whl

  echo >&2 'Packaging the documentation'
  install -D -m 644 -t "${pkgdir}/usr/share/doc/${pkgname}" \
    docs/*.md

  echo >&2 'Packaging the license'
  install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
    LICENSE

  echo >&2 'Removing test files'
  _site_packages="$(python -c "import site; print(site.getsitepackages()[0])")"
  # https://github.com/google/python-fire/issues/422
  rm -fv "${pkgdir}/${_site_packages}/${_gitpkgname}/"{testutils,*_test}.py
}