aboutsummaryrefslogtreecommitdiffstats
path: root/testing/py-fonttools/APKBUILD
blob: d79737eca5142b1a3b1aa11feedcb8c9d17b6726 (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
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=py-fonttools
pkgver=3.21.2
pkgrel=0
pkgdesc="Converts OpenType and TrueType fonts to and from XML"
url="https://github.com/fonttools/fonttools"
arch="noarch"
license="BSD"
depends="py-numpy"
makedepends="python2-dev python3-dev py-setuptools"
install=""
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc"
source="py-fonttools-$pkgver.tar.gz::https://github.com/fonttools/fonttools/archive/$pkgver.tar.gz"
builddir="$srcdir/fonttools-$pkgver"

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

package() {
	mkdir -p "$pkgdir"/usr/bin/
	local name; for name in fonttools pyftinspect pyftmerge pyftsubset ttx; do
		ln -s $name-3 "$pkgdir"/usr/bin/$name || return 1
	done

	cd "$builddir"
	for man in Doc/man/man1/*.?; do
		install -Dm644 "$man" \
			"$pkgdir"/usr/share/man/man${man##*.}/${man##*/} || return 1
	done
}

_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 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

	# Remove man pages and ship them in the -doc subpackage.
	rm -rf "$subpkgdir"/usr/share/man/
}

_py2() {
	replaces="$pkgname"
	_py python2
}

_py3() {
	_py python3
}

sha512sums="64ee4043f35cae39b0d4a00a5445dffa5afebda9c5571f204b909f91d640bc07c7a3c464430da3b9d36e1c9dd2fd14ae547db48cc00cc5b0da39099cb4d7cbb9  py-fonttools-3.21.2.tar.gz"