~dricottone/huttese-apk

ref: eef67f2a433369fa39f2597af9ee310f3ef27d1b huttese-apk/sr.ht/py-pygments/APKBUILD -rw-r--r-- 2.4 KiB
eef67f2a — Drew DeVault py3-case: add py3-six to depends 5 years ago
                                                                                
8e65c17c Martijn Braam
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=py-pygments
_pkgname=Pygments
pkgver=2.2.0
pkgrel=2
pkgdesc="A syntax highlighting package written in Python."
url="http://pygments.org/"
arch="noarch"
license="BSD"
depends="py3-${pkgname#py-}"
makedepends="python2-dev python3-dev py-setuptools"
subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3 $pkgname-doc::noarch"
source="
	https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	pr-779-python3-in-analyze_text.patch
	pr-815-support-dmesg.patch
"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	# Soure files are modified during build with 2to3 tool, so we must build
	# it separately for each Python version.
	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"

	mkdir -p "$pkgdir"/usr/bin
	ln -s pygmentize-3 "$pkgdir"/usr/bin/pygmentize
}

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

_py3() {
	_py python3
}

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

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

	local path; for path in "$subpkgdir"/usr/bin/*; do
		mv "$path" "$path-$pyver" || return 1
	done
}

doc() {
	local destdir="$subpkgdir/usr/share/doc/$pkgname"

	cd "$builddir"

	install -m 644 -D doc/pygmentize.1 \
		"$subpkgdir"/usr/share/man/man1/pygmentize.1 || return 1

	mkdir -p "$destdir" || return 1
	cp AUTHORS CHANGES LICENSE TODO "$destdir"/ || return 1

	# Note: The documentation in the doc directory needs to be generated
	# by py-sphinx
	cp -R ./doc/docs/* "$destdir"/ || return 1

	default_doc
}

sha512sums="cc0a4f73e19fa6cbf46314de2e809460c807c631e39ba05cbe5edb5f40db1a687aafcd9715585a0ed45f791710eb6038305e273f282f8682df76f30e63710b29  Pygments-2.2.0.tar.gz
72292d486cd905e68a9f6ee7a717da490a3c187b220b1a24a9ea14f49f588abe9909ff64fab5cc4d58a9756637e033b4a58a53faabeb18b20a08cf4e553dc81d  pr-779-python3-in-analyze_text.patch
295068965bce2ed6e97ce69b984dd1dcd070d9bc09a4bc12f77ca45c6d327c31ec5ebeb573a38ad26a5f977f633b30ae2c23379403a7d7c17e46863e6f1c7311  pr-815-support-dmesg.patch"