sci-calculators/units: Version 2.19
[gentoo.git] / sci-calculators / units / units-2.19.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python{2_7,3_5,3_6} )
6 inherit python-single-r1
7
8 DESCRIPTION="Unit conversion program"
9 HOMEPAGE="https://www.gnu.org/software/units/units.html"
10 SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
11
12 LICENSE="FDL-1.3 GPL-3"
13 SLOT="0"
14 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
15 IUSE="+units_cur"
16 REQUIRED_USE="units_cur? ( ${PYTHON_REQUIRED_USE} )"
17
18 RDEPEND="
19         sys-libs/readline:=
20         units_cur? (
21                 ${PYTHON_DEPS}
22                 dev-python/future[${PYTHON_USEDEP}]
23                 dev-python/requests[${PYTHON_USEDEP}]
24         )
25 "
26 DEPEND="
27         ${RDEPEND}
28 "
29 PATCHES=(
30         "${FILESDIR}"/${PN}-2.17-network-sandbox.patch
31 )
32
33 pkg_setup() {
34         use units_cur && python-single-r1_pkg_setup
35 }
36
37 src_configure() {
38         econf \
39                 --sharedstatedir="${EROOT}/var/lib" \
40                 ac_cv_path_PYTHON=no
41 }
42
43 src_compile() {
44         emake ${PN}
45 }
46
47 src_install() {
48         emake DESTDIR="${D}" install
49
50         dodoc ChangeLog NEWS README
51
52         # we're intentionally delaying this since 'make install' would
53         # get confused if we shove 'units_cur' there, and there is no real
54         # need to add more complexity for it
55         if use units_cur; then
56                 sed \
57                         -e "/^outfile/s|'.*'|'/usr/share/units/currency.units'|g" \
58                         -e 's|^#!|&/usr/bin/python|g' \
59                         units_cur_inst > units_cur || die
60                 python_fix_shebang units_cur
61                 python_doscript units_cur
62         fi
63 }