Merge media-sound/spotify: Fix homepage URL
[gentoo.git] / app-portage / g-octave / g-octave-0.4.1-r4.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="2"
6 SUPPORT_PYTHON_ABIS="1"
7 RESTRICT_PYTHON_ABIS="2.5 *-jython"
8
9 DB_COMMIT="bdf02cbf0a8d017c6c1bddeffd6f03d5d90695ed"
10 DB_DIR="rafaelmartins-${PN}-db-${DB_COMMIT:0:7}"
11
12 inherit distutils eutils
13
14 DESCRIPTION="A tool that generates and installs ebuilds for Octave-Forge"
15 HOMEPAGE="https://github.com/rafaelmartins/g-octave"
16
17 SRC_URI="mirror://github/rafaelmartins/${PN}/${P}.tar.gz
18         https://github.com/rafaelmartins/${PN}-db/tarball/${DB_COMMIT} ->
19                 ${PN}-db-${DB_COMMIT:0:7}.tar.gz"
20
21 LICENSE="GPL-2"
22 SLOT="0"
23 KEYWORDS="~amd64 ~x86"
24 IUSE="doc test"
25
26 DEPEND="doc? ( >=dev-python/sphinx-1.0 )"
27 RDEPEND="sys-apps/portage"
28
29 PYTHON_MODNAME="g_octave"
30
31 src_prepare() {
32         distutils_src_prepare
33         epatch "${FILESDIR}/${P}-add_cave_support.patch"
34         epatch "${FILESDIR}/${P}-fix-sourceforge-svn-root.patch"
35         epatch "${FILESDIR}/${P}-fix-Makefile.patch"
36         sed -i -e 's/^has_fetch.*$/has_fetch = False/' scripts/g-octave \
37                 || die 'failed to patch the g-octave main script'
38 }
39
40 src_compile() {
41         distutils_src_compile
42         if use doc; then
43                 emake -C docs html || die 'failed to compile the documentation.'
44         fi
45 }
46
47 src_install() {
48         distutils_src_install
49         dohtml ${PN}.html || die 'dohtml failed.'
50         doman ${PN}.1 || die 'doman failed.'
51         if use doc; then
52                 mv docs/_build/{html,sphinx} || die 'mv failed.'
53                 dohtml -r docs/_build/sphinx || die 'dohtml failed.'
54         fi
55 }
56
57 src_test() {
58         testing() {
59                 PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" \
60                         scripts/run_tests.py || die 'test failed.'
61         }
62         python_execute_function testing
63 }
64
65 pkg_postinst() {
66         distutils_pkg_postinst
67         elog
68         elog 'To be able to use g-octave with the shipped package database, please'
69         elog 'edit your configuration file, clean your db directory and run:'
70         elog "    emerge --config =${PF}"
71         elog
72         elog "If you are upgrading from =${PN}-0.3, please read this:"
73         elog "http://g-octave.readthedocs.org/en/latest/upgrading/#from-0-3-to-0-4"
74         elog
75         elog 'Please install the package manager that you want to use before run g-octave'
76         elog
77 }
78
79 pkg_config() {
80         local db="$(g-octave --config db)"
81         mkdir -p "${db}"
82         einfo "Extracting g-octave database files to: ${db}"
83         tar -xzf "${DISTDIR}/${PN}-db-${DB_COMMIT:0:7}.tar.gz" -C "${db}" || die 'tar failed.'
84         rm -rf "${db}"/{patches,octave-forge,info.json,manifest.json,timestamp}
85         mv -f "${db}/${DB_DIR}"/* "${db}" || die 'mv failed.'
86         rm -rf "${db}/${DB_DIR}"
87 }