Gentoo Archives: gentoo-commits

From: "Arun Raghavan (ford_prefect)" <ford_prefect@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: gnome-python-common.eclass
Date: Sun, 24 Aug 2008 07:10:37
Message-Id: E1KX9kA-0002ub-Mw@stork.gentoo.org
1 ford_prefect 08/08/24 07:10:34
2
3 Added: gnome-python-common.eclass
4 Log:
5 Common functionality required for splitting various GNOME python bindings
6
7 Revision Changes Path
8 1.1 eclass/gnome-python-common.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnome-python-common.eclass?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnome-python-common.eclass?rev=1.1&content-type=text/plain
12
13 Index: gnome-python-common.eclass
14 ===================================================================
15 # Copyright 1999-2008 Gentoo Foundation
16 # Distributed under the terms of the GNU General Public License v2
17 # $Header: /var/cvsroot/gentoo-x86/eclass/gnome-python-common.eclass,v 1.1 2008/08/24 07:10:34 ford_prefect Exp $
18
19 # Original Author: Arun Raghavan <ford_prefect@g.o> (based on the
20 # gnome-python-desktop eclass by Jim Ramsay <lack@g.o>)
21 #
22 # Purpose: Provides common functionality requried for building the gnome-python*
23 # bindings
24 #
25 # Important environment variables:
26 #
27 # G_PY_PN: Which gnome-python* package bindings we're working with. Defaults to
28 # gnome-python if unset.
29 #
30 # G_PY_BINDINGS: The actual '--enable-<binding>' name, which by default is ${PN}
31 # excluding the -python at the end. May be overridden if necessary.
32 #
33 # EXAMPLES: The set of example files to be installed if the 'examples' USE flag
34 # is set.
35 #
36 # The naming convention for all bindings is as follows:
37 # dev-python/<original-${PN}-for-which-this-is-the-binding>-python
38 #
39 # So, for example, with the bonobo bindings, the original package is libbonobo
40 # and the packages is named dev-python/libbonobo-python
41
42 inherit versionator python autotools gnome2
43
44 G_PY_PN=${G_PY_PN:-gnome-python}
45 G_PY_BINDINGS=${G_PY_BINDINGS:-${PN%-python}}
46
47 PVP="$(get_version_component_range 1-2)"
48 SRC_URI="mirror://gnome/sources/${G_PY_PN}/${PVP}/${G_PY_PN}-${PV}.tar.bz2"
49 HOMEPAGE="http://pygtk.org/"
50
51 RESTRICT="${RESTRICT} test"
52
53 DOCS="AUTHORS ChangeLog NEWS README"
54 if [[ ${G_PY_PN} != "gnome-python" ]]; then
55 DOCS="${DOCS} MAINTAINERS"
56 fi
57
58 S="${WORKDIR}/${G_PY_PN}-${PV}"
59
60 RDEPEND="~dev-python/${G_PY_PN}-base-${PV}"
61 DEPEND="${RDEPEND}
62 dev-util/pkgconfig"
63
64 # Enable the required bindings as specified by the G_PY_BINDINGS variable
65 gnome-python-common_pkg_setup() {
66 G2CONF="${G2CONF} --disable-allbindings"
67 for binding in ${G_PY_BINDINGS}; do
68 G2CONF="${G2CONF} --enable-${binding}"
69 done
70 }
71
72 gnome-python-common_src_unpack() {
73 unpack ${A}
74 cd "${S}"
75
76 # disable pyc compiling
77 if [[ -f py-compile ]]; then
78 rm py-compile
79 ln -s $(type -P true) py-compile
80 fi
81 }
82
83 # Do a regular gnome2 src_install and then install examples if required.
84 # Set the variable EXAMPLES to provide the set of examples to be installed.
85 # (to install a directory recursively, specify it with a trailing '/' - for
86 # example, foo/bar/)
87 gnome-python-common_src_install() {
88 # The .pc file is installed by respective gnome-python*-base package
89 sed -i '/^pkgconfig_DATA/d' Makefile || die "sed failed"
90 sed -i '/^pkgconfigdir/d' Makefile || die "sed failed"
91
92 gnome2_src_install
93
94 if hasq examples ${IUSE} && use examples; then
95 insinto /usr/share/doc/${PF}/examples
96
97 for example in ${EXAMPLES}; do
98 if [[ ${example: -1} = "/" ]]; then
99 doins -r ${example}
100 else
101 doins ${example}
102 fi
103 done
104 fi
105 }
106
107 gnome-python-common_pkg_postinst() {
108 python_version
109 python_mod_optimize /usr/$(get_libdir)/python${PYVER}/site-packages/gtk-2.0
110 }
111
112 gnome-python-common_pkg_postrm() {
113 python_mod_cleanup
114 }
115
116 EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm