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