Merge github#363: sys-process/atop: add systemd support
[gentoo.git] / sci-calculators / units / units-2.12.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7 PYTHON_REQ_USE="xml"
8 inherit eutils python-r1
9
10 DESCRIPTION="Unit conversion program"
11 HOMEPAGE="https://www.gnu.org/software/units/units.html"
12 SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
13
14 LICENSE="FDL-1.3 GPL-3"
15 SLOT="0"
16 KEYWORDS="alpha amd64 ~arm hppa ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
17 IUSE="+units_cur"
18
19 DEPEND="
20         sys-libs/readline:=
21         units_cur? (
22                 dev-lang/python-exec:2
23         )
24 "
25 RDEPEND="
26         ${DEPEND}
27         units_cur? (
28                 dev-python/unidecode[${PYTHON_USEDEP}]
29                 ${PYTHON_DEPS}
30         )
31 "
32
33 units_cur_prepare() {
34         local UNITS_PYTHON_MAJOR
35         UNITS_PYTHON_MAJOR=$(
36                 UNITS_PYTHON_MAJOR=${EPYTHON/.*}
37                 shopt -s extglob
38                 echo ${UNITS_PYTHON_MAJOR/*([[:alpha:]])}
39         )
40         sed -e "/^outfile/s|'.*'|'/usr/share/units/currency.units'|g" units_cur${UNITS_PYTHON_MAJOR} > units_cur-${EPYTHON}
41 }
42
43 src_prepare() {
44         use units_cur && python_foreach_impl units_cur_prepare
45 }
46
47 src_compile() {
48         emake HAVE_PYTHON=no
49 }
50
51 units_cur_install() {
52         python_newexe units_cur-${EPYTHON} units_cur
53 }
54
55 src_install() {
56         emake DESTDIR="${D}" HAVE_PYTHON=no install
57
58         dodoc ChangeLog NEWS README
59
60         use units_cur && python_foreach_impl units_cur_install
61 }