dev-python/kombu: 4.6.8 allarches stablized
[gentoo.git] / dev-python / pygobject / pygobject-2.28.6-r55.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5 GCONF_DEBUG="no"
6 GNOME2_LA_PUNT="yes"
7 PYTHON_COMPAT=( python2_7 )
8
9 inherit autotools eutils gnome2 python-r1 virtualx
10
11 DESCRIPTION="GLib's GObject library bindings for Python"
12 HOMEPAGE="http://www.pygtk.org/"
13
14 LICENSE="LGPL-2.1+"
15 SLOT="2"
16 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
17 IUSE="examples libffi test"
18 RESTRICT="!test? ( test )"
19 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
20
21 COMMON_DEPEND=">=dev-libs/glib-2.24.0:2
22         dev-lang/python-exec:2
23         libffi? ( virtual/libffi:= )
24         ${PYTHON_DEPS}
25 "
26 DEPEND="${COMMON_DEPEND}
27         dev-util/gtk-doc-am
28         virtual/pkgconfig
29         test? (
30                 media-fonts/font-cursor-misc
31                 media-fonts/font-misc-misc )
32 "
33 RDEPEND="${COMMON_DEPEND}
34         !<dev-python/pygtk-2.23"
35
36 src_prepare() {
37         # Fix FHS compliance, see upstream bug #535524
38         epatch "${FILESDIR}/${PN}-2.28.3-fix-codegen-location.patch"
39
40         # Do not build tests if unneeded, bug #226345
41         epatch "${FILESDIR}/${PN}-2.28.3-make_check.patch"
42
43         # Support installation for multiple Python versions, upstream bug #648292
44         epatch "${FILESDIR}/${PN}-2.28.3-support_multiple_python_versions.patch"
45
46         # Disable tests that fail
47         epatch "${FILESDIR}/${P}-disable-failing-tests.patch"
48
49         # Disable introspection tests when we build with --disable-introspection
50         epatch "${FILESDIR}/${P}-tests-no-introspection.patch"
51
52         # Fix warning spam
53         epatch "${FILESDIR}/${P}-set_qdata.patch"
54         epatch "${FILESDIR}/${P}-gio-types-2.32.patch"
55
56         # Fix glib-2.36 compatibility, bug #486602
57         epatch "${FILESDIR}/${P}-glib-2.36-class_init.patch"
58
59         sed -i \
60                 -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' \
61                 -e 's:AM_PROG_CC_STDC:AC_PROG_CC:' \
62                 configure.ac || die
63
64         eautoreconf
65         gnome2_src_prepare
66
67         python_copy_sources
68
69         prepare_shebangs() {
70                 # Make a backup with unconverted shebangs to keep python_doscript happy
71                 cp codegen/codegen.py pygobject-codegen-2.0
72                 sed -e "s%#! \?/usr/bin/env python%#!${PYTHON}%" \
73                         -i codegen/*.py || die "shebang convertion failed"
74         }
75         python_foreach_impl run_in_build_dir prepare_shebangs
76 }
77
78 src_configure() {
79         DOCS="AUTHORS ChangeLog* NEWS README"
80         # --disable-introspection and --disable-cairo because we use pygobject:3
81         # for introspection support
82         G2CONF="${G2CONF}
83                 --disable-introspection
84                 --disable-cairo
85                 $(use_with libffi ffi)"
86
87         python_foreach_impl run_in_build_dir gnome2_src_configure
88 }
89
90 src_compile() {
91         python_foreach_impl run_in_build_dir gnome2_src_compile
92 }
93
94 # FIXME: With python multiple ABI support, tests return 1 even when they pass
95 src_test() {
96         unset DBUS_SESSION_BUS_ADDRESS
97         export GIO_USE_VFS="local" # prevents odd issues with deleting ${T}/.gvfs
98
99         testing() {
100                 export XDG_CACHE_HOME="${T}/${EPYTHON}"
101                 run_in_build_dir Xemake -j1 check
102                 unset XDG_CACHE_HOME
103         }
104         python_foreach_impl testing
105         unset GIO_USE_VFS
106 }
107
108 src_install() {
109         installing() {
110                 local f prefixed_sitedir
111
112                 gnome2_src_install
113
114                 python_doscript pygobject-codegen-2.0
115
116                 # Don't keep multiple copies of pygobject-codegen-2.0 script
117                 prefixed_sitedir=$(python_get_sitedir)
118                 dosym "${prefixed_sitedir#${EPREFIX}}/gtk-2.0/codegen/codegen.py" "/usr/lib/python-exec/${EPYTHON}/pygobject-codegen-2.0"
119         }
120         python_foreach_impl run_in_build_dir installing
121
122         if use examples; then
123                 insinto /usr/share/doc/${PF}
124                 doins -r examples
125         fi
126 }
127
128 run_in_build_dir() {
129         pushd "${BUILD_DIR}" > /dev/null || die
130         "$@"
131         popd > /dev/null
132 }