Skip to content

Commit

Permalink
app-text/gtranslator: switch python requirements to python3
Browse files Browse the repository at this point in the history
One of the last user of the libpeas python2 loader support. Kill gnome
USE flag and replace it with more meaningful ones. Switch to EAPI=6.

Package-Manager: Portage-2.3.5, Repoman-2.3.2
  • Loading branch information
EvaSDK committed Apr 17, 2017
1 parent f410392 commit f01aac1
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app-text/gtranslator/files/gtranslator-2.91.7-gi-silence.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From acc785dd63379f08f08b52fae9d7e5c5666495c8 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <[email protected]>
Date: Mon, 17 Apr 2017 00:15:58 +0200
Subject: [PATCH] Silence gobject-introspection warning on version-less imports

---
plugins/charmap/charmap/__init__.py | 3 +++
1 file changed, 3 insertions(+)

diff --git a/plugins/charmap/charmap/__init__.py b/plugins/charmap/charmap/__init__.py
index b504cb61..6f8c2b61 100644
--- a/plugins/charmap/charmap/__init__.py
+++ b/plugins/charmap/charmap/__init__.py
@@ -16,6 +16,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

+import gi
+gi.require_version('Gucharmap', '2.90')
+
from gi.repository import GObject, Gio, Pango, Gtk, Gtranslator, Gucharmap
from .panel import CharmapPanel
import sys
--
2.12.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 1e4d042f7e9b28a58bd09af5c97e4282441113d2 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <[email protected]>
Date: Sun, 16 Apr 2017 23:48:29 +0200
Subject: [PATCH 1/2] Switch gucharmap plugin to python3 loader

---
plugins/charmap/charmap/__init__.py | 2 +-
plugins/charmap/gtr-charmap.plugin.desktop.in | 2 +-
src/gtr-plugins-engine.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/charmap/charmap/__init__.py b/plugins/charmap/charmap/__init__.py
index 414157b1..b504cb61 100644
--- a/plugins/charmap/charmap/__init__.py
+++ b/plugins/charmap/charmap/__init__.py
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from gi.repository import GObject, Gio, Pango, Gtk, Gtranslator, Gucharmap
-from panel import CharmapPanel
+from .panel import CharmapPanel
import sys
import gettext

diff --git a/plugins/charmap/gtr-charmap.plugin.desktop.in b/plugins/charmap/gtr-charmap.plugin.desktop.in
index 3949c5f6..a872a545 100644
--- a/plugins/charmap/gtr-charmap.plugin.desktop.in
+++ b/plugins/charmap/gtr-charmap.plugin.desktop.in
@@ -1,5 +1,5 @@
[Plugin]
-Loader=python
+Loader=python3
Module=charmap
IAge=3
_Name=Character Map
diff --git a/src/gtr-plugins-engine.c b/src/gtr-plugins-engine.c
index 903ea735..8e41010a 100644
--- a/src/gtr-plugins-engine.c
+++ b/src/gtr-plugins-engine.c
@@ -64,7 +64,7 @@ gtr_plugins_engine_init (GtrPluginsEngine * engine)
GTR_TYPE_PLUGINS_ENGINE,
GtrPluginsEnginePrivate);

- peas_engine_enable_loader (PEAS_ENGINE (engine), "python");
+ peas_engine_enable_loader (PEAS_ENGINE (engine), "python3");

engine->priv->plugin_settings = g_settings_new ("org.gnome.gtranslator.plugins");

--
2.12.2

82 changes: 82 additions & 0 deletions app-text/gtranslator/gtranslator-2.91.7-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
GNOME2_LA_PUNT="yes"
PYTHON_COMPAT=( python{3_4,3_5} )

inherit gnome2 python-single-r1

DESCRIPTION="An enhanced gettext po file editor for GNOME"
HOMEPAGE="https://wiki.gnome.org/Apps/Gtranslator"

LICENSE="GPL-3+ FDL-1.1+"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="+introspection gnome-dictionary gucharmap spell"
REQUIRED_USE="gucharmap? ( introspection ${PYTHON_REQUIRED_USE} )"

COMMON_DEPEND="
>=dev-libs/glib-2.32:2[dbus]
>=x11-libs/gtk+-3.4.2:3[introspection?]
>=x11-libs/gtksourceview-3.0.0:3.0[introspection?]
>=dev-libs/gdl-3.6:3=
>=dev-libs/libxml2-2.4.12:2
>=dev-libs/json-glib-0.12.0
>=dev-libs/libpeas-1.2[gtk]
gnome-extra/libgda:5=
>=app-text/iso-codes-0.35
gnome-base/gsettings-desktop-schemas
gnome-dictionary? ( app-dicts/gnome-dictionary:= )
gucharmap? ( ${PYTHON_DEPS} )
introspection? ( >=dev-libs/gobject-introspection-0.9.3 )
spell? ( app-text/gtkspell:3= )
"
RDEPEND="${COMMON_DEPEND}
x11-themes/gnome-icon-theme-symbolic
gucharmap? (
>=dev-libs/libpeas-1.2[gtk,python,${PYTHON_USEDEP}]
dev-python/pygobject:3[${PYTHON_USEDEP}]
gnome-extra/gucharmap:2.90[introspection]
x11-libs/gtk+:3[introspection] )
"
DEPEND="${COMMON_DEPEND}
>=dev-util/gtk-doc-am-1
>=dev-util/intltool-0.50.1
>=sys-devel/gettext-0.17
virtual/pkgconfig
"
# eautoreconf requires gnome-base/gnome-common, app-text/yelp-tools

PATCHES=(
# Switch plugin to python3 loader
"${FILESDIR}"/${P}-gucharmap-python3.patch
# Silence g-i import warnings
"${FILESDIR}"/${P}-gi-silence.patch
)

pkg_setup() {
use gucharmap && python-single-r1_pkg_setup
}

src_prepare() {
DOCS="AUTHORS ChangeLog HACKING INSTALL NEWS README THANKS"

gnome2_src_prepare

if ! use gucharmap ; then
# don't install charmap plugin, it requires gnome-extra/gucharmap
sed -e 's:\scharmap\s: :g' -i plugins/Makefile.* ||
die "sed plugins/Makefile.* failed"
fi
}

src_configure() {
gnome2_src_configure \
--disable-static \
$(use_enable introspection) \
$(use_with gnome-dictionary dictionary) \
$(use_with spell gtkspell)
}
4 changes: 4 additions & 0 deletions app-text/gtranslator/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<email>[email protected]</email>
<name>Gentoo GNOME Desktop</name>
</maintainer>
<use>
<flag name="gnome-dictionary">Enable plugin for dictionary lookups using <pkg>app-dicts/gnome-dictionary</pkg>.</flag>
<flag name="gucharmap">Enable plugin for unicode symbols selection using <pkg>gnome-extra/gucharmap</pkg>.</flag>
</use>
<upstream>
<remote-id type="sourceforge">gtranslator</remote-id>
</upstream>
Expand Down

0 comments on commit f01aac1

Please sign in to comment.