summaryrefslogtreecommitdiff
blob: 301644d847045b776fa0f3f4d4dcfb535ebded2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/kde-base/pykde4/pykde4-4.4.1.ebuild,v 1.1 2010/03/02 19:42:27 tampakrap Exp $

EAPI="3"

KMNAME="kdebindings"
KMMODULE="python/pykde4"
OPENGL_REQUIRED="always"
PYTHON_USE_WITH="threads"
SUPPORT_PYTHON_ABIS="1"
inherit python kde4-meta

DESCRIPTION="Python bindings for KDE4"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="akonadi debug doc examples semantic-desktop"

# blocker added due to compatibility issues and error during compile time
DEPEND="
	!dev-python/pykde
	$(add_kdebase_dep kdelibs 'opengl,semantic-desktop?')
	akonadi? ( $(add_kdebase_dep kdepimlibs) )
	aqua? ( >=dev-python/PyQt4-4.7[dbus,sql,svg,webkit,aqua] )
	!aqua? ( >=dev-python/PyQt4-4.7[dbus,sql,svg,webkit,X] )
"
RDEPEND="${DEPEND}"

pkg_setup() {
	python_pkg_setup
	kde4-meta_pkg_setup
}

src_prepare() {
	kde4-meta_src_prepare

	if ! use examples; then
		sed -e '/^ADD_SUBDIRECTORY(examples)/s/^/# DISABLED /' -i python/${PN}/CMakeLists.txt \
			|| die "Failed to disable examples"
	fi

	python_copy_sources
}

src_configure() {
	savedcmakeargs=(
		-DWITH_QScintilla=OFF
		-DWITH_PolkitQt=OFF
		$(cmake-utils_use_with semantic-desktop Soprano)
		$(cmake-utils_use_with semantic-desktop Nepomuk)
		$(cmake-utils_use_with akonadi KdepimLibs)
	)

	do_src_configure() {
		mycmakeargs=("${savedcmakeargs[@]}")

		CMAKE_USE_DIR="${S}-${PYTHON_ABI}"
		kde4-meta_src_configure

		local value=$(declare -p mycmakeargs)
		value=${value#*=}
		declare -a "savedcmakeargs_${PYTHON_ABI//./_}=$value"
	}

	python_execute_function -s do_src_configure
}

src_compile() {
	do_src_compile() {
		CMAKE_USE_DIR="${S}-${PYTHON_ABI}"
		kde4-meta_src_compile
	}

	python_execute_function -s do_src_compile
}

src_test() {
	do_src_test() {
		local var=savedcmakeargs_${PYTHON_ABI//./_}
		local value=$(declare -p $var)
		value=${value#*=}
		declare -a "mycmakeargs=$value"

		CMAKE_USE_DIR="${S}-${PYTHON_ABI}"
		kde4-meta_src_test
		export ${var}="${mycmakeargs}"
	}

	python_execute_function -s do_src_test
}

src_install() {
	if use doc; then
		dohtml -r "${S}"/python/pykde4/docs/html/* || die 'dohtml failed'
	fi

	do_src_install() {
		CMAKE_USE_DIR="${S}-${PYTHON_ABI}"
		kde4-meta_src_install

		rm -f "${ED}$(python_get_sitedir)"/PyKDE4/*.py[co]
	}

	python_execute_function -s do_src_install
}

pkg_postinst() {
	kde4-meta_pkg_postinst

	python_mod_optimize PyKDE4

	if use examples; then
		echo
		elog "PyKDE4 examples have been installed to"
		elog "${EKDEDIR}/share/apps/${PN}/examples"
		echo
	fi
}

pkg_postrm() {
	kde4-meta_pkg_postrm

	python_mod_cleanup PyKDE4
}