*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-vcs / git-cola / git-cola-3.2.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 DISTUTILS_SINGLE_IMPL=true
8
9 inherit distutils-r1 readme.gentoo-r1 virtualx
10
11 DESCRIPTION="The highly caffeinated git GUI"
12 HOMEPAGE="https://git-cola.github.io/"
13 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
18 IUSE="doc test"
19 RESTRICT="!test? ( test )"
20
21 RDEPEND="dev-python/QtPy[gui,${PYTHON_USEDEP}]
22         dev-python/numpy[${PYTHON_USEDEP}]
23         dev-python/pygments[${PYTHON_USEDEP}]
24         dev-python/send2trash[${PYTHON_USEDEP}]
25         dev-vcs/git"
26 DEPEND="${RDEPEND}
27         sys-devel/gettext
28         doc? (
29                 dev-python/sphinx[${PYTHON_USEDEP}]
30                 python_targets_python2_7? ( dev-python/sphinxtogithub[$(python_gen_usedep 'python2*')] )
31                 )
32         test? (
33                 ${VIRTUALX_DEPEND}
34                 dev-python/nose[${PYTHON_USEDEP}]
35                 dev-python/mock[${PYTHON_USEDEP}]
36                 )"
37
38 python_prepare_all() {
39         # make sure that tests also use the system provided QtPy
40         rm -r qtpy || die
41
42         rm share/git-cola/bin/*askpass* || die
43
44         # don't install docs into wrong location
45         sed -i -e '/doc/d' setup.py || die
46
47         # fix doc directory reference
48         sed -i \
49                 -e "s/'doc', 'git-cola'/'doc', '${PF}'/" \
50                 cola/resources.py || die
51
52         # fix ssh-askpass directory reference
53         sed -i -e 's/resources\.share/resources\.prefix/' cola/app.py || die
54
55         distutils-r1_python_prepare_all
56 }
57
58 python_configure_all() {
59         mydistutilsargs=( --no-vendor-libs )
60 }
61
62 python_compile_all() {
63         cd share/doc/${PN}/ || die
64         if use doc ; then
65                 emake all
66         else
67                 sed \
68                         -e '/^install:/s:install-html::g' \
69                         -e '/^install:/s:install-man::g' \
70                         -i Makefile || die
71         fi
72 }
73
74 python_test() {
75         PYTHONPATH="${S}:${S}/build/lib:${PYTHONPATH}" LC_ALL="en_US.utf8" \
76         virtx nosetests --verbose --with-id --with-doctest \
77                 --exclude=sphinxtogithub
78 }
79
80 src_install() {
81         distutils-r1_src_install
82 }
83
84 python_install_all() {
85         cd share/doc/${PN}/ || die
86         emake \
87                 DESTDIR="${D}" \
88                 docdir="${EPREFIX}/usr/share/doc/${PF}" \
89                 prefix="${EPREFIX}/usr" \
90                 install
91
92         python_fix_shebang "${ED}/usr/share/git-cola/bin/git-xbase" "${ED}"/usr/bin/git-cola
93         python_optimize "${ED}/usr/share/git-cola/lib/cola"
94
95         use doc || HTML_DOCS=( "${FILESDIR}"/index.html )
96
97         distutils-r1_python_install_all
98         readme.gentoo_create_doc
99 }