Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH python-r1 5/8] Convert x11-misc/redshift to python-r1 (example).
Date: Sat, 27 Oct 2012 11:05:02
Message-Id: 1351335771-3618-5-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH python-r1 1/8] python_export: support obtaining site-packages directory. by "Michał Górny"
1 This serves as an example how the new functions can be used.
2 ---
3 gx86/x11-misc/redshift/redshift-1.7-r1.ebuild | 33 ++++++++++++---------------
4 1 file changed, 14 insertions(+), 19 deletions(-)
5
6 diff --git a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
7 index f3bd210..589e571 100644
8 --- a/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
9 +++ b/gx86/x11-misc/redshift/redshift-1.7-r1.ebuild
10 @@ -3,12 +3,9 @@
11 # $Header: /var/cvsroot/gentoo-x86/x11-misc/redshift/redshift-1.7-r1.ebuild,v 1.5 2012/08/16 20:40:38 hasufell Exp $
12
13 EAPI=4
14 +PYTHON_COMPAT=( python{2_6,2_7} )
15
16 -PYTHON_DEPEND="gtk? 2:2.6"
17 -SUPPORT_PYTHON_ABIS="1"
18 -RESTRICT_PYTHON_ABIS="2.[45] 3.*"
19 -
20 -inherit autotools eutils gnome2-utils python
21 +inherit autotools eutils gnome2-utils python-r1
22
23 DESCRIPTION="A screen color temperature adjusting software"
24 HOMEPAGE="http://jonls.dk/redshift/"
25 @@ -24,7 +21,8 @@ COMMON_DEPEND=">=x11-libs/libX11-1.4
26 x11-libs/libxcb
27 geoclue? ( app-misc/geoclue )
28 gnome? ( dev-libs/glib:2
29 - >=gnome-base/gconf-2 )"
30 + >=gnome-base/gconf-2 )
31 + gtk? ( ${PYTHON_DEPS} )"
32 RDEPEND="${COMMON_DEPEND}
33 gtk? ( >=dev-python/pygtk-2
34 dev-python/pyxdg )"
35 @@ -32,12 +30,14 @@ DEPEND="${COMMON_DEPEND}
36 nls? ( sys-devel/gettext )"
37
38 src_prepare() {
39 - >py-compile
40 epatch "${FILESDIR}"/${P}-make-conditionals.patch
41 + epatch_user
42 eautoreconf
43 }
44
45 src_configure() {
46 + python_export_best
47 +
48 econf \
49 --disable-silent-rules \
50 $(use_enable nls) \
51 @@ -53,17 +53,12 @@ src_configure() {
52 src_install() {
53 default
54
55 - # handle multiple python abi support
56 - per_abi_install() {
57 - cp "${D}"/usr/bin/gtk-redshift "${D}"/usr/bin/gtk-redshift-${PYTHON_ABI} || die
58 - python_convert_shebangs ${PYTHON_ABI} "${D}"/usr/bin/gtk-redshift-${PYTHON_ABI}
59 - emake DESTDIR="${D}" pythondir="$(python_get_sitedir)" -C src/gtk-redshift install
60 - }
61 + if use gtk; then
62 + python_foreach_impl \
63 + emake DESTDIR="${D}" pythondir="$(python_get_sitedir)" \
64 + -C src/gtk-redshift install
65
66 - if use gtk ; then
67 - rm -R "${D}"/usr/$(get_libdir)/python* || die
68 - python_execute_function per_abi_install
69 - python_generate_wrapper_scripts -f "${D}"/usr/bin/gtk-redshift
70 + python_replicate_scripts "${D}"/usr/bin/gtk-redshift
71 fi
72 }
73
74 @@ -72,9 +67,9 @@ pkg_preinst() {
75 }
76
77 pkg_postinst() {
78 - use gtk && { gnome2_icon_cache_update; python_mod_optimize gtk_${PN}; }
79 + use gtk && gnome2_icon_cache_update
80 }
81
82 pkg_postrm() {
83 - use gtk && { gnome2_icon_cache_update; python_mod_cleanup gtk_${PN}; }
84 + use gtk && gnome2_icon_cache_update
85 }
86 --
87 1.7.12.4

Replies