aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-docutils/APKBUILD
blob: d7dfe79a9d25f41de57c48a040aa0680b57de7d0 (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
# Contributor: Matt Smith <mcs@darkregion.net>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=py-docutils
_pkgname=docutils
pkgver=0.12
pkgrel=1
pkgdesc="Documentation Utilities for Python"
url="http://docutils.sourceforge.net/"
arch="noarch"
license="Public Domain"
depends="py-pillow py-roman"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc"
source="http://downloads.sourceforge.net/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"
	python2 setup.py build || return 1
	python3 setup.py build || return 1
}

package() {
	mkdir -p "$pkgdir"
}

_py2() {
	replaces="$pkgname"
	depends="${depends//py-/py2-}"
	_py python2
}

_py3() {
	depends="${depends//py-/py3-}"
	_py python3
}

_py() {
	local python="$1"
	pkgdesc="$pkgdesc (for $python)"
	depends="$depends $python"
	install_if="$pkgname=$pkgver-r$pkgrel $python"

	cd "$builddir"
	$python setup.py install --prefix=/usr --root="$subpkgdir"
}

doc() {
	cd "$_builddir"

	for _docdir in docs licenses; do
		mkdir -p "$subpkgdir"/usr/share/doc/$pkgname/$_docdir \
			|| return 1
		cp -R ./$_docdir/* "$subpkgdir"/usr/share/doc/$pkgname/$_docdir/ \
			|| return 1
		chmod -R 644 "$subpkgdir"/usr/share/doc/$pkgname/$_docdir/ \
			|| return 1
	done

	for _doc in BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt THANKS.txt; do
		install -m644 -D $_doc "$subpkgdir"/usr/share/doc/$pkgname/ \
			|| return 1
	done

	# Fix subdir perms
	find "$subpkgdir"/usr/share/doc/$pkgname/ -type d -exec chmod 755 '{}' \;
}

md5sums="4622263b62c5c771c03502afa3157768  docutils-0.12.tar.gz"
sha256sums="c7db717810ab6965f66c8cf0398a98c9d8df982da39b4cd7f162911eb89596fa  docutils-0.12.tar.gz"
sha512sums="0087433f8b76e1d0302d2fab77fdbda941132d16ac1fcecb26ca66119687eefd9e2f6901e05d705f857fa31e2526136c9827dfd57c44cd295bd10dcce3faebf9  docutils-0.12.tar.gz"