aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-sphinx/APKBUILD
blob: 70f1e8a056ac0779658acd806eb7f2f59294ebff (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: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=py-sphinx
_pkgname=${pkgname#py-}
pkgver=1.5.3
pkgrel=0
pkgdesc="Python Documentation Generator"
url="http://sphinx.pocoo.org/"
arch="noarch"
license="BSD"
_pydepends="py-docutils py-jinja2 py-pygments py-six py-sphinx_rtd_theme
	py-alabaster<0.8 py-babel py-snowballstemmer py-imagesize py-requests"
depends="py3-${pkgname#py-}"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3"
source="$_pkgname-$pkgver.tar.gz::https://github.com/sphinx-doc/sphinx/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	# Soure files are modified during build with 2to3 tool, so we cannot
	# build it for both Python versions in the same location.
	local python; for python in python2 python3; do
		cp -r "$builddir" "$builddir-$python" || return 1
	done
}

build() {
	local python; for python in python2 python3; do
		cd "$builddir"-$python
		$python setup.py build || return 1
	done
}

package() {
	mkdir -p "$pkgdir"/usr/bin

	local name; for name in apidoc autogen build quickstart; do
		ln -s sphinx-$name-3 "$pkgdir"/usr/bin/sphinx-$name || return 1
	done
}

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

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

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

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

	# Add version suffix to executable files.
	local path; for path in "$subpkgdir"/usr/bin/*; do
		mv "$path" "$path-$pyver" || return 1
	done
}

sha512sums="2db9dbf60c9bed6809f1f9a90a8a5412552da48cdc6a998cc9c49bdb664dce6a8d9c2ef7d7198cc8cf64cc4776f99730b806c8a0dddc95a94cfe921b25a3cd6c  sphinx-1.5.3.tar.gz"