*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / pygments / pygments-2.2.0.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{6,7} pypy3 )
7
8 inherit distutils-r1 bash-completion-r1 vcs-snapshot
9
10 MY_PN="Pygments"
11 MY_P="${MY_PN}-${PV}"
12
13 DESCRIPTION="Pygments is a syntax highlighting package written in Python"
14 HOMEPAGE="http://pygments.org/ https://pypi.org/project/Pygments/"
15 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
20 IUSE="doc test"
21 RESTRICT="!test? ( test )"
22
23 RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
24 DEPEND="${RDEPEND}
25         doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
26         test? (
27                 dev-python/nose[${PYTHON_USEDEP}]
28                 virtual/ttf-fonts )"
29 #               dev-texlive/texlive-latexrecommended
30 # Removing / commenting out this dep. I can find no mention of it in tests other than
31 # importing pygment's own tex module.  If it's there and I missed it just uncomment and re-add
32 # Tests pass without it
33
34 S="${WORKDIR}/${MY_P}"
35
36 PATCHES=(
37         # fix generators for python3.7+
38         "${FILESDIR}"/pygments-2.2.0-pep479.patch
39 )
40
41 python_compile_all() {
42         use doc && emake -C doc html
43 }
44
45 python_test() {
46         cp -r -l tests "${BUILD_DIR}"/ || die
47         # With pypy3 there is 1 error out of 1556 tests when run as is and
48         # (SKIP=8, errors=1, failures=1) when run with 2to3; meh
49         nosetests --verbosity=3 -w "${BUILD_DIR}"/tests \
50                 || die "Tests fail with ${EPYTHON}"
51 }
52
53 python_install_all() {
54         use doc && local HTML_DOCS=( doc/_build/html/. )
55
56         distutils-r1_python_install_all
57         newbashcomp external/pygments.bashcomp pygmentize
58 }