# Contributor: Peter Bui # Maintainer: Matt Smith pkgname=py-pygments _pkgname=Pygments pkgver=2.4.2 pkgrel=0 pkgdesc="A syntax highlighting package written in Python." url="http://pygments.org/" arch="noarch" license="BSD-2-Clause" depends="py3-${pkgname#py-}" makedepends="python2-dev python3-dev py-setuptools" checkdepends="py-nose py3-nose" 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" builddir="$srcdir/$_pkgname-$pkgver" prepare() { default_prepare # 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" done } build() { local python; for python in python2 python3; do cd "$builddir"-$python $python setup.py build done } check() { local python; for python in python2 python3; do cd "$builddir"-$python $python tests/run.py 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" local path; for path in "$subpkgdir"/usr/bin/*; do mv "$path" "$path-$pyver" 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 mkdir -p "$destdir" cp AUTHORS CHANGES LICENSE TODO "$destdir"/ # Note: The documentation in the doc directory needs to be generated # by py-sphinx cp -R ./doc/docs/* "$destdir"/ default_doc } sha512sums="c8f378700e99d9e5701ac7e27363921dbabab50a910686aafda1e016c813e99915fcfeed8298323b9b681b3d81f4265ab9a5bb75b8cdff0668c9eff745337b66 Pygments-2.4.2.tar.gz"