units-2.13.ebuild 1.2 KB

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