archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / rst2pdf / trunk / PKGBUILD
blob7ffbbf2d8833d42903b6a617947c8b5e220fb34d
1 # Maintainer: David Runge <dvzrv@archlinux.org>
3 pkgname=rst2pdf
4 pkgver=0.100
5 pkgrel=3
6 pkgdesc="Use a text editor. Make a PDF"
7 arch=(any)
8 url="https://github.com/rst2pdf/rst2pdf"
9 license=(MIT)
10 depends=(
11   python
12   python-docutils
13   python-importlib-metadata
14   python-jinja
15   python-packaging
16   python-pillow
17   python-pygments
18   python-reportlab
19   python-smartypants
20   python-yaml
22 makedepends=(
23   python-build
24   python-installer
25   python-setuptools-scm
26   python-wheel
28 # TODO: package python-xhtml2pdf
29 # https://github.com/xhtml2pdf/xhtml2pdf/issues/560
30 checkdepends=(
31   graphviz
32   plantuml
33   python-aafigure
34   python-matplotlib
35   python-pytest
36   python-pymupdf
37   python-sphinx
38   python-svglib
40 # TODO: package python-xhtml2pdf
41 optdepends=(
42   'plantuml: for UML diagram support'
43   'python-aafigure: for ASCII image support'
44   'python-pyphen: for hyphenation support'
45   'python-matplotlib: for math support'
46   'python-sphinx: for sphinx support'
47   'python-svglib: for SVG support'
49 source=($pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/refs/tags/$pkgver.tar.gz)
50 sha512sums=('ad08629ddec84c50463da726caba71ee3045a37a62fdd58f33afb4ecabeae1b5b0b5ca139d11996ba733f9e03f893e0e7108cd9cbbdd6f0ec9b1c81056b9c3da')
51 b2sums=('bbc448e8a1fa6a50dc9883a0466de1ec6f0f99582a0d968733f2801766fa1ee2793c84186887144ebd75b79f757689248cbb3334716ceddb80dc2bdc73f729ed')
53 build() {
54   cd $pkgname-$pkgver
55   export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
56   python -m build --wheel --no-isolation
59 check() {
60   local pytest_options=(
61     -vv
62     # https://github.com/rst2pdf/rst2pdf/issues/1067
63     --deselect tests/input/test_raw_html.rst::test_raw_html
64   )
65   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
67   cd $pkgname-$pkgver
68   python -m installer --destdir="test_dir" dist/*.whl
70   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
71   export PATH="$PWD/test_dir/usr/bin:$PATH"
72   pytest "${pytest_options[@]}"
75 package() {
76   cd $pkgname-$pkgver
77   python -m installer --destdir="$pkgdir" dist/*.whl
78   install -vDm 644 {CHANGES,MAINTAINERS,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
79   install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"