games-util/pyfa: Switch to PYTHON_MULTI_USEDEP API
[gentoo.git] / games-util / pyfa / pyfa-9999.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5 PYTHON_COMPAT=( python3_6 )
6 PYTHON_REQ_USE="sqlite,threads"
7
8 inherit desktop eutils python-single-r1 xdg-utils
9
10 DESCRIPTION="Python Fitting Assistant - a ship fitting application for EVE Online"
11 HOMEPAGE="https://github.com/pyfa-org/Pyfa"
12
13 LICENSE="GPL-3+ all-rights-reserved"
14 SLOT="0"
15 if [[ ${PV} = 9999 ]]; then
16         EGIT_REPO_URI="https://github.com/pyfa-org/Pyfa.git"
17         inherit git-r3
18 else
19         SRC_URI="https://github.com/pyfa-org/Pyfa/archive/v${PV}.tar.gz -> ${P}.tar.gz"
20         KEYWORDS="~amd64 ~x86"
21         S=${WORKDIR}/Pyfa-${PV}
22 fi
23 IUSE=""
24 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
25 RESTRICT="mirror bindist"
26
27 DEPEND="
28         $(python_gen_cond_dep '
29                 >=dev-python/cryptography-2.3[${PYTHON_MULTI_USEDEP}]
30                 >=dev-python/logbook-1.0.0[${PYTHON_MULTI_USEDEP}]
31                 >=dev-python/pyyaml-5.1[${PYTHON_MULTI_USEDEP}]
32                 >=dev-python/sqlalchemy-1.3.0[${PYTHON_MULTI_USEDEP}]
33                 >=dev-python/wxpython-4.0.4[webkit,${PYTHON_MULTI_USEDEP}]
34         ')
35         ${PYTHON_DEPS}"
36 RDEPEND="${DEPEND}
37         $(python_gen_cond_dep '
38                 >=dev-python/beautifulsoup-4.6.0[${PYTHON_MULTI_USEDEP}]
39                 >=dev-python/markdown2-2.3.0[${PYTHON_MULTI_USEDEP}]
40                 >=dev-python/packaging-16.8[${PYTHON_MULTI_USEDEP}]
41                 dev-python/python-dateutil[${PYTHON_MULTI_USEDEP}]
42                 >=dev-python/requests-2.0.0[${PYTHON_MULTI_USEDEP}]
43                 >=dev-python/roman-2.0.0[${PYTHON_MULTI_USEDEP}]
44                 >=dev-python/matplotlib-2.0.0[wxwidgets,${PYTHON_MULTI_USEDEP}]
45                 dev-python/numpy[${PYTHON_MULTI_USEDEP}]
46         ')"
47 BDEPEND="app-arch/zip"
48
49 PATCHES=(
50         # fix import path in the main script for systemwide installation
51         "${FILESDIR}/${PN}-2.9.3-import-pyfa.patch"
52         )
53
54 src_prepare() {
55         # get rid of CRLF line endings introduced in 1.1.10 so patches work
56         edos2unix config.py pyfa.py gui/bitmap_loader.py service/settings.py
57
58         default
59
60         # make python recognize pyfa as a package
61         touch __init__.py || die
62
63         sed -e "s:%%SITEDIR%%:$(python_get_sitedir):" \
64                 -e "s:%%EPREFIX%%:${EPREFIX}:" \
65                 "${FILESDIR}/configforced-1.15.1.py" > configforced.py || die
66         sed -e "s:%%SITEDIR%%:$(python_get_sitedir):" \
67                 pyfa.py > pyfa || die
68 }
69
70 src_install() {
71         python_moduleinto ${PN}
72         python_domodule eos gui service utils graphs
73         python_domodule config*.py __init__.py version.yml configforced.py db_update.py
74         python_doscript pyfa
75
76         insinto /usr/share/${PN}
77
78         einfo "Creating database ..."
79         python ./db_update.py || die
80         doins eve.db
81
82         einfo "Compressing images ..."
83         pushd imgs > /dev/null || die
84         zip -r imgs.zip * || die "zip failed"
85         doins imgs.zip
86         popd > /dev/null || die
87
88         dodoc README.md
89         doicon -s 32 imgs/gui/pyfa.png
90         newicon -s 64 imgs/gui/pyfa64.png pyfa.png
91         domenu "${FILESDIR}/${PN}.desktop"
92 }
93
94 pkg_postinst() {
95         xdg_icon_cache_update
96 }
97
98 pkg_postrm() {
99         xdg_icon_cache_update
100 }