summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6a3c179b7960fd301cb484d871cc0c2aa8cf2e90 (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
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

_pkgname=htmlmin
pkgbase=python-htmlmin
pkgname=('htmlmin' 'python-htmlmin')
pkgver=0.1.12
_gitcommit=220b1d16442eb4b6fafed338ee3b61f698a01e63
pkgrel=10
pkgdesc='Configurable HTML Minifier with safety features'
url='https://htmlmin.readthedocs.io/en/latest/'
arch=('any')
license=('BSD-3-Clause')
makedepends=('python-sphinx' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest')
source=(${pkgbase}-${pkgver}.tar.gz::https://github.com/mankyd/htmlmin/archive/${_gitcommit}.tar.gz)
sha256sums=('9d96f711d1f3d997f29bf83e704fc8dae0233beb400afa278792ff8349cd22a2')
sha512sums=('6d9db4b6bcdd6d223be8b4e3830da4d63ac6d7d28ee83abd97809b0b901968c994c8434c992fbdd148101ba25d8d786c93657cb5f82881af44dadbba40bf3252')

build() {
  cd ${_pkgname}-${_gitcommit}
  python -m build --wheel --skip-dependency-check --no-isolation
  sphinx-build -b text docs docs/_build/text
  sphinx-build -b man docs docs/_build/man
}

check() {
  cd ${_pkgname}-${_gitcommit}
  pytest
}

package_htmlmin() {
  depends=('python' 'python-setuptools' 'python-htmlmin')
  pkgdesc+=' (CLI)'
  cd ${_pkgname}-${_gitcommit}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -d "${pkgdir}/usr/share/"{licenses,doc,man/man1}
  ln -s /usr/share/licenses/python-htmlmin "${pkgdir}/usr/share/licenses/${pkgname}"
  ln -s /usr/share/doc/python-htmlmin "${pkgdir}/usr/share/doc/${pkgname}"
  ln -s /usr/share/man/man1/python-htmlmin.1.gz "${pkgdir}/usr/share/man/man1/htmlmin.1.gz"

  rm -r "${pkgdir}"/usr/lib
}

package_python-htmlmin() {
  depends=('python')
  cd ${_pkgname}-${_gitcommit}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.rst CHANGELOG -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 docs/_build/text/*.txt -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/man/htmlmin.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"

  rm -r "${pkgdir}"/usr/lib/python*/site-packages/htmlmin/tests \
    "${pkgdir}/usr/bin"
}

# vim: ts=2 sw=2 et: