]> git.draconx.ca Git - gentoo-fixes.git/blob - dev-python/pygobject/pygobject-2.28.6-r57.ebuild
Work around python-r1 eclass dropping python2.
[gentoo-fixes.git] / dev-python / pygobject / pygobject-2.28.6-r57.ebuild
1 # Copyright © 2020-2021 Nick Bowler
2 #
3 # License GPLv2+: GNU General Public License version 2 or any later version.
4 # This is free software: you are free to change and redistribute it.
5 # There is NO WARRANTY, to the extent permitted by law.
6 #
7 # This is a modified version of the original ebuild from Gentoo GNU/Linux,
8 # covered by the following copyright and permission notice:
9 #
10 #   Copyright 1999-2020 Gentoo Authors
11 #   Distributed under the terms of the GNU General Public License v2
12
13 EAPI=7
14
15 GNOME2_LA_PUNT=yes
16 GNOME2_EAUTORECONF=yes
17
18 _PYTHON_ALLOW_PY27=1
19 PYTHON_COMPAT=( python2_7 )
20
21 inherit autotools eutils gnome2 python-r1 virtualx
22
23 DESCRIPTION="GLib's GObject library bindings for Python"
24 HOMEPAGE="http://www.pygtk.org/"
25
26 LICENSE="LGPL-2.1+"
27 SLOT="2"
28 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"
29 IUSE="examples libffi test"
30 RESTRICT="!test? ( test )"
31 REQUIRED_USE=$PYTHON_REQUIRED_USE
32
33 BDEPEND="virtual/pkgconfig
34         dev-util/gtk-doc-am"
35
36 RDEPEND=">=dev-libs/glib-2.24.0:2
37         dev-lang/python-exec:2
38         libffi? ( dev-libs/libffi:= )
39         !<dev-python/pygtk-2.23
40         $PYTHON_DEPS"
41
42 DEPEND="$RDEPEND
43         test? (
44                 media-fonts/font-cursor-misc
45                 media-fonts/font-misc-misc )"
46
47 PATCHES=(
48         # Fix FHS compliance, see upstream bug #535524
49         "$FILESDIR/$PN-2.28.3-fix-codegen-location.patch"
50
51         # Do not build tests if unneeded, bug #226345
52         "$FILESDIR/$PN-2.28.3-make_check.patch"
53
54         # Support installation for multiple Python versions, upstream bug #648292
55         "$FILESDIR/$PN-2.28.3-support_multiple_python_versions.patch"
56
57         # Disable tests that fail
58         "$FILESDIR/$P-disable-failing-tests.patch"
59
60         # Disable introspection tests when we build with --disable-introspection
61         "$FILESDIR/$P-tests-no-introspection.patch"
62
63         # Fix warning spam
64         "$FILESDIR/$P-set_qdata.patch"
65         "$FILESDIR/$P-gio-types-2.32.patch"
66
67         # Fix glib-2.36 compatibility, bug #486602
68         "$FILESDIR/$P-glib-2.36-class_init.patch"
69
70         # Fix python byte-compilation
71         "$FILESDIR/$P-python-byte-compile.patch"
72 )
73
74 src_prepare() {
75         sed -i \
76                 -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' \
77                 -e 's:AM_PROG_CC_STDC:AC_PROG_CC:' \
78                 configure.ac || die
79
80         gnome2_src_prepare
81
82         python_copy_sources
83         prepare_shebangs() {
84                 # Make a backup with unconverted shebangs to keep python_doscript happy
85                 cp codegen/codegen.py pygobject-codegen-2.0
86                 sed -e "s%#! \?/usr/bin/env python%#!${PYTHON}%" \
87                         -i codegen/*.py || die "shebang convertion failed"
88         }
89         python_foreach_impl run_in_build_dir prepare_shebangs
90 }
91
92 src_configure() {
93         DOCS="AUTHORS ChangeLog* NEWS README"
94
95         # --disable-introspection and --disable-cairo because we use pygobject:3
96         # for introspection support
97         myconf=(
98                 --disable-introspection
99                 --disable-cairo
100                 $(use_with libffi ffi)
101         )
102
103         python_foreach_impl run_in_build_dir gnome2_src_configure "${myconf[@]}"
104 }
105
106 src_compile() {
107         python_foreach_impl run_in_build_dir gnome2_src_compile
108 }
109
110 # FIXME: With python multiple ABI support, tests return 1 even when they pass
111 src_test() {
112         unset DBUS_SESSION_BUS_ADDRESS
113         export GIO_USE_VFS="local" # prevents odd issues with deleting ${T}/.gvfs
114
115         testing() {
116                 export XDG_CACHE_HOME="${T}/${EPYTHON}"
117                 run_in_build_dir Xemake -j1 check
118                 unset XDG_CACHE_HOME
119         }
120         python_foreach_impl testing
121         unset GIO_USE_VFS
122 }
123
124 src_install() {
125         installing() {
126                 local f prefixed_sitedir
127
128                 gnome2_src_install
129
130                 python_doscript pygobject-codegen-2.0
131
132                 # Don't keep multiple copies of pygobject-codegen-2.0 script
133                 prefixed_sitedir=$(python_get_sitedir)
134                 dosym "${prefixed_sitedir#${EPREFIX}}/gtk-2.0/codegen/codegen.py" "/usr/lib/python-exec/${EPYTHON}/pygobject-codegen-2.0"
135         }
136         python_foreach_impl run_in_build_dir installing
137
138         if use examples; then
139                 insinto /usr/share/doc/${PF}
140                 doins -r examples
141         fi
142 }