APKBUILD 1.34 KB
Newer Older
Peter Bui's avatar
Peter Bui committed
1
# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
2
# Maintainer: Matt Smith <mcs@darkregion.net>
Leo's avatar
Leo committed
3
pkgname=py3-pygments
Matt Smith's avatar
Matt Smith committed
4
_pkgname=Pygments
5
pkgver=2.7.3
Leo's avatar
Leo committed
6 7
pkgrel=0
pkgdesc="Syntax highlighting package written in Python"
8
url="https://pygments.org/"
9
arch="noarch"
Leo's avatar
Leo committed
10
license="BSD-2-Clause"
Leo's avatar
Leo committed
11 12
depends="python3 py3-setuptools"
checkdepends="py3-pytest"
Leo's avatar
Leo committed
13
subpackages="$pkgname-doc::noarch"
14 15
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
Matt Smith's avatar
Matt Smith committed
16

Leo's avatar
Leo committed
17 18
replaces="py-pygments" # Backwards compatibility
provides="py-pygments=$pkgver-r$pkgrel" # Backwards compatibility
19

Matt Smith's avatar
Matt Smith committed
20
build() {
Leo's avatar
Leo committed
21
	python3 setup.py build
Leo's avatar
Leo committed
22 23 24
}

check() {
Leo's avatar
Leo committed
25
	python3 -m pytest
Matt Smith's avatar
Matt Smith committed
26 27 28
}

package() {
Leo's avatar
Leo committed
29
	python3 setup.py install --prefix=/usr --root="$pkgdir"
30 31

	mkdir -p "$pkgdir"/usr/bin
Leo's avatar
Leo committed
32
	ln -s pygmentize "$pkgdir"/usr/bin/pygmentize-3
Matt Smith's avatar
Matt Smith committed
33 34 35
}

doc() {
36
	local destdir="$subpkgdir/usr/share/doc/$pkgname"
Matt Smith's avatar
Matt Smith committed
37

38
	cd "$builddir"
Matt Smith's avatar
Matt Smith committed
39

40
	install -m 644 -D doc/pygmentize.1 \
Leo's avatar
Leo committed
41
		"$subpkgdir"/usr/share/man/man1/pygmentize.1
Peter Bui's avatar
Peter Bui committed
42

Leo's avatar
Leo committed
43
	mkdir -p "$destdir"
Leo's avatar
Leo committed
44
	cp AUTHORS CHANGES LICENSE "$destdir"/
45

Peter Bui's avatar
Peter Bui committed
46 47
	# Note: The documentation in the doc directory needs to be generated
	# by py-sphinx
Leo's avatar
Leo committed
48
	cp -R ./doc/docs/* "$destdir"/
Matt Smith's avatar
Matt Smith committed
49

50
	default_doc
Matt Smith's avatar
Matt Smith committed
51 52
}

53
sha512sums="fe58ce0beb3d2fd88b374d7864e93dba41e4e2ad6dca570e284fd76615c5bb4e78459a4b8c4dd5f61603d4bccd5705cebafd7274369d158af149e838ec63f7eb  Pygments-2.7.3.tar.gz"