*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-editors / qhexedit2 / qhexedit2-0.8.4.ebuild
1 # Copyright 2017-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python{2_7,3_6} )
7
8 DISTUTILS_OPTIONAL=1
9
10 inherit distutils-r1 qmake-utils
11
12 DESCRIPTION="Hex editor library, Qt application written in C++ with Python bindings"
13 HOMEPAGE="https://github.com/lancos/qhexedit2/"
14 SRC_URI="https://github.com/lancos/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="doc +gui python"
20 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
21
22 PATCHES=(
23         "${FILESDIR}/${P}-fixtest.patch"
24         "${FILESDIR}/${P}-setup.py.patch"
25 )
26
27 RDEPEND="
28         dev-qt/qtcore:5
29         dev-qt/qtgui:5
30         dev-qt/qtwidgets:5
31         python? ( dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
32                         dev-python/sip[${PYTHON_USEDEP}]
33                         ${PYTHON_DEPS} )
34 "
35 DEPEND="${RDEPEND}"
36
37 src_prepare() {
38         default
39         sed -i -e '/^unix:DESTDIR/ d' -e "\$atarget.path = /usr/$(get_libdir)" \
40                 -e "\$aINSTALLS += target" src/qhexedit.pro \
41                 || die "src/qhexedit.pro: sed failed"
42         use python && distutils-r1_src_prepare
43 }
44
45 src_configure() {
46         eqmake5 src/qhexedit.pro
47         if use gui; then
48                 cd example || die "can't cd example"
49                 eqmake5 qhexedit.pro
50         fi
51 }
52
53 src_compile() {
54         default
55         use python && distutils-r1_src_compile
56         if use gui; then
57                 cd example || die "can't cd example"
58                 emake
59         fi
60 }
61
62 python_compile() {
63         use python && distutils-r1_python_compile build_ext --library-dirs="${S}"
64 }
65
66 src_test() {
67         cd test || die "can't cd test"
68         mkdir logs || die "can't create logs dir"
69         eqmake5 chunks.pro
70         emake
71         ./chunks || die "test run failed"
72         grep -q "^NOK" logs/Summary.log && die "test failed"
73 }
74
75 src_install() {
76         emake INSTALL_ROOT="${D}" install
77         use python && distutils-r1_src_install
78         use gui && dobin example/qhexedit
79         if use doc; then
80                 dodoc -r doc/html
81                 dodoc doc/release.txt
82         fi
83 }