*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / pygments / pygments-2.2.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python2_7 python3_{6,7} pypy3 )
7
8 inherit distutils-r1 bash-completion-r1
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
30 S="${WORKDIR}/${MY_P}"
31
32 PATCHES=(
33         # fix generators for python3.7+
34         "${FILESDIR}"/pygments-2.2.0-pep479.patch
35         # Fixing USE="doc" with sphinx1.7+. bug #662640
36         "${FILESDIR}"/pygments-2.2.0-sphinx17.patch
37 )
38
39 python_compile_all() {
40         use doc && emake -C doc html
41 }
42
43 python_test() {
44         cp -r -l tests "${BUILD_DIR}"/ || die
45         # With pypy3 there is 1 error out of 1556 tests when run as is and
46         # (SKIP=8, errors=1, failures=1) when run with 2to3; meh
47         nosetests --verbosity=3 -w "${BUILD_DIR}"/tests \
48                 || die "Tests fail with ${EPYTHON}"
49 }
50
51 python_install_all() {
52         use doc && local HTML_DOCS=( doc/_build/html/. )
53
54         distutils-r1_python_install_all
55         newbashcomp external/pygments.bashcomp pygmentize
56 }