summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b94e947894b76976cbe6f2b74b869e7ec7a4b531 (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
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>
# Contributor: Mathieu Clabaut <mathieu.clabaut@gmail.com>
# Contributor: Eric Anderson <ejona86@gmail.com>

pkgname=python-cliapp-fiw
_gitpkgname="${pkgname%-fiw}"
pkgver=1.20180812.1
pkgrel=3
pkgdesc='Python framework for Unix-like command line programs'
arch=('any')
url='https://blog.liw.fi/posts/cliapp/'
license=('GPL-2.0-or-later')
depends=('python' 'python-yaml')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
optdepends=(
  'python-pyxdg: to honor XDG_CONFIG_HOME for configuration files'
)
conflicts=('python-cliapp') # unrelated package
options=('!debug' '!strip')

source=(
  "${_gitpkgname}-${pkgver}.tar.gz::http://git.liw.fi/cliapp/snapshot/cliapp-${pkgver}.tar.gz"
  'python-3.12-compat.patch'
)

sha512sums=(
  '61b6f36abb3eefb1c52752e8eb1048c1629c86aa269fcac9c5ee4d875031a040c9c3824131f953dc9bfe568e9e99202750c2e8c11791afe3fce1c1872ce2510d'
  '606851b6a8c21627aa253facd087e416d07513f424ef01a0519702b55b050784aa4cb3cbd55e1cca4231af255001b18b6b3e8850b688e9b3f32f6835b7de0316'
)

prepare() {
  cd "cliapp-${pkgver}"
  echo 'global-exclude *_tests.py' > MANIFEST.in
  patch -p1 < ../python-3.12-compat.patch
}

build() {
  cd "cliapp-${pkgver}"

  # Build wheel from sdist so it honors MANIFEST.in, which prevents
  # tests from ending up inside the wheel
  python -m build --no-isolation
}

check() {
  cd "cliapp-${pkgver}"
  python -m unittest cliapp/*_tests.py
}

package() {
  cd "cliapp-${pkgver}"
  python -I -m installer --destdir="${pkgdir}" dist/*.whl

  echo >&2 'Packaging examples'
  install -D -m 644 -t "${pkgdir}/usr/share/${pkgname}/examples" example*.py

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

  echo >&2 'Packaging the README'
  install -D -m 644 README \
    "${pkgdir}"/usr/share/doc/${pkgname}/README
}