From 0bc625eebec67fd8bde2fd0895eb90e875a10107 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Dec 18 2013 13:38:15 +0000 Subject: Fix locales handling --- diff --git a/gnome-abrt-0.3.3-fix_locales_handling.patch b/gnome-abrt-0.3.3-fix_locales_handling.patch new file mode 100644 index 0000000..9be4ee5 --- /dev/null +++ b/gnome-abrt-0.3.3-fix_locales_handling.patch @@ -0,0 +1,297 @@ +From c0376b90248bdde820cd7d4005897e4fce2f8b9d Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Wed, 18 Dec 2013 12:58:29 +0100 +Subject: [GNOME-ABRT PATCH 1/2] Fix locales handling + +The glade file must not be converted to a python script because it makes +impossible for gettex to load the localized strings. + +Closes rhbz#1044241 + +Signed-off-by: Jakub Filak +--- + po/POTFILES.in | 1 + + src/gnome_abrt/Makefile.am | 17 ++++++----------- + src/gnome_abrt/__init__.py.in | 1 + + src/gnome_abrt/views.py | 35 ++++++++++++++++++++++++++--------- + 4 files changed, 34 insertions(+), 20 deletions(-) + +diff --git a/po/POTFILES.in b/po/POTFILES.in +index 0820dd1..3998806 100644 +--- a/po/POTFILES.in ++++ b/po/POTFILES.in +@@ -1,3 +1,4 @@ ++src/gnome-abrt + src/gnome-abrt.desktop.in + src/gnome-abrt.appdata.xml.in + +diff --git a/src/gnome_abrt/Makefile.am b/src/gnome_abrt/Makefile.am +index d14a82e..2c74135 100644 +--- a/src/gnome_abrt/Makefile.am ++++ b/src/gnome_abrt/Makefile.am +@@ -15,8 +15,7 @@ gnome_abrtexec_PYTHON = \ + signals.py \ + tools.py \ + views.py \ +- l10n.py \ +- gnome_abrt_glade.py ++ l10n.py + + controller.py: controller.py.in Makefile + sed -e s,\@libexecdir\@,$(libexecdir),g $< > $@ +@@ -24,23 +23,19 @@ controller.py: controller.py.in Makefile + __init__.py: __init__.py.in Makefile + sed -e s,\@PACKAGE\@,$(PACKAGE),g \ + -e s,\@VERSION\@,$(VERSION),g \ ++ -e s,\@GNOME_ABRT_UI_DIR\@,$(uidir),g \ + -e s,\@localedir\@,$(localedir),g $< > $@ + +-gnome_abrt_glade.py: oops.glade Makefile +- { \ +- echo '# coding=utf-8'; \ +- echo 'GNOME_ABRT_GLADE_CONTENTS ="\'; \ +- cat oops.glade | sed -e 's/\"/\\\"/g' -e 's/$$/\\/'; \ +- echo '"'; \ +- } >gnome_abrt_glade.py ++dist_ui_DATA = oops.glade ++uidir = $(pkgdatadir)/ui + + gnome_abrtdir = $(pythondir)/gnome_abrt + + EXTRA_DIST = __init__.py.in oops.glade controller.py.in + +-DISTCLEANFILES = __init__.py controller.py gnome_abrt_glade.py ++DISTCLEANFILES = __init__.py controller.py + +-all-local: __init__.py controller.py gnome_abrt_glade.py ++all-local: __init__.py controller.py + + check-local: $(gnome_abrtexec_PYTHON) + if USE_PYLINT +diff --git a/src/gnome_abrt/__init__.py.in b/src/gnome_abrt/__init__.py.in +index a4c151a..392efba 100644 +--- a/src/gnome_abrt/__init__.py.in ++++ b/src/gnome_abrt/__init__.py.in +@@ -17,6 +17,7 @@ + + PACKAGE = "@PACKAGE@" + VERSION = "@VERSION@" ++GNOME_ABRT_UI_DIR = "@GNOME_ABRT_UI_DIR@" + + def init(): + import gnome_abrt.l10n +diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py +index de184ab..8d4e923 100644 +--- a/src/gnome_abrt/views.py ++++ b/src/gnome_abrt/views.py +@@ -29,11 +29,14 @@ import traceback + from gi.repository import Gtk + #pylint: disable=E0611 + from gi.repository import Gdk ++#pylint: disable=E0611 ++from gi.repository import GObject + + import gnome_abrt.problems as problems + import gnome_abrt.config as config + import gnome_abrt.wrappers as wrappers + import gnome_abrt.errors as errors ++from gnome_abrt import GNOME_ABRT_UI_DIR + from gnome_abrt.tools import fancydate + from gnome_abrt.l10n import _, GETTEXT_PROGNAME + +@@ -140,16 +143,30 @@ def handle_problem_and_source_errors(func): + class OopsWindow(Gtk.ApplicationWindow): + class OopsGtkBuilder(object): + def __init__(self): +- builder = Gtk.Builder() +- self._builder = builder +- builder.set_translation_domain(GETTEXT_PROGNAME) ++ builder = None ++ # try to load the glade from git at first step ++ ui_files = ['./src/gnome_abrt/oops.glade', ++ GNOME_ABRT_UI_DIR + '/oops.glade'] ++ for glade_file in ui_files: ++ if os.path.exists(glade_file): ++ builder = Gtk.Builder() ++ builder.set_translation_domain(GETTEXT_PROGNAME) ++ try: ++ builder.add_from_file(filename=glade_file) ++ except GObject.GError as ex: ++ builder = None ++ logging.debug("Failed to load UI file: '{0}': {1}" ++ .format(glade_file, str(ex))) ++ else: ++ break ++ else: ++ logging.debug("UI file does not exist: '{0}'" ++ .format(glade_file)) + +- if os.path.exists('oops.glade'): +- builder.add_from_file(filename='oops.glade') +- else: +- from gnome_abrt import gnome_abrt_glade +- builder.add_from_string( +- gnome_abrt_glade.GNOME_ABRT_GLADE_CONTENTS) ++ if builder is None: ++ raise RuntimeError(_("Failed to load UI definition")) ++ ++ self._builder = builder + + self.wnd_main = builder.get_object('wnd_main') + self.gr_main_layout = builder.get_object('gr_main_layout') +--- a/src/gnome_abrt/Makefile.in ++++ b/src/gnome_abrt/Makefile.in +@@ -13,6 +13,7 @@ + # PARTICULAR PURPOSE. + + @SET_MAKE@ ++ + VPATH = @srcdir@ + am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' + am__make_running_with_option = \ +@@ -79,7 +80,8 @@ + host_triplet = @host@ + subdir = src/gnome_abrt + DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ +- $(gnome_abrtexec_PYTHON) $(top_srcdir)/py-compile ++ $(gnome_abrtexec_PYTHON) $(top_srcdir)/py-compile \ ++ $(dist_ui_DATA) + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ +@@ -150,10 +152,12 @@ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } + am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile) +-am__installdirs = "$(DESTDIR)$(gnome_abrtexecdir)" ++am__installdirs = "$(DESTDIR)$(gnome_abrtexecdir)" \ ++ "$(DESTDIR)$(uidir)" + am__pep3147_tweak = \ + sed -e 's|\.py$$||' -e 's|[^/]*$$|__pycache__/&.*.py|' + py_compile = $(top_srcdir)/py-compile ++DATA = $(dist_ui_DATA) + RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive + am__recursive_targets = \ +@@ -395,12 +399,13 @@ + signals.py \ + tools.py \ + views.py \ +- l10n.py \ +- gnome_abrt_glade.py ++ l10n.py + ++dist_ui_DATA = oops.glade ++uidir = $(pkgdatadir)/ui + gnome_abrtdir = $(pythondir)/gnome_abrt + EXTRA_DIST = __init__.py.in oops.glade controller.py.in +-DISTCLEANFILES = __init__.py controller.py gnome_abrt_glade.py ++DISTCLEANFILES = __init__.py controller.py + all: all-recursive + + .SUFFIXES: +@@ -488,6 +493,27 @@ + $(am__uninstall_files_from_dir) || st=$$?; \ + done; \ + exit $$st ++install-dist_uiDATA: $(dist_ui_DATA) ++ @$(NORMAL_INSTALL) ++ @list='$(dist_ui_DATA)'; test -n "$(uidir)" || list=; \ ++ if test -n "$$list"; then \ ++ echo " $(MKDIR_P) '$(DESTDIR)$(uidir)'"; \ ++ $(MKDIR_P) "$(DESTDIR)$(uidir)" || exit 1; \ ++ fi; \ ++ for p in $$list; do \ ++ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ++ echo "$$d$$p"; \ ++ done | $(am__base_list) | \ ++ while read files; do \ ++ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(uidir)'"; \ ++ $(INSTALL_DATA) $$files "$(DESTDIR)$(uidir)" || exit $$?; \ ++ done ++ ++uninstall-dist_uiDATA: ++ @$(NORMAL_UNINSTALL) ++ @list='$(dist_ui_DATA)'; test -n "$(uidir)" || list=; \ ++ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ ++ dir='$(DESTDIR)$(uidir)'; $(am__uninstall_files_from_dir) + + # This directory's subdirectories are mostly independent; you can cd + # into them and run 'make' without going through this Makefile. +@@ -646,10 +672,10 @@ + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local + check: check-recursive +-all-am: Makefile all-local ++all-am: Makefile $(DATA) all-local + installdirs: installdirs-recursive + installdirs-am: +- for dir in "$(DESTDIR)$(gnome_abrtexecdir)"; do \ ++ for dir in "$(DESTDIR)$(gnome_abrtexecdir)" "$(DESTDIR)$(uidir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done + install: install-recursive +@@ -703,7 +729,7 @@ + + info-am: + +-install-data-am: ++install-data-am: install-dist_uiDATA + + install-dvi: install-dvi-recursive + +@@ -747,7 +773,7 @@ + + ps-am: + +-uninstall-am: uninstall-gnome_abrtexecPYTHON ++uninstall-am: uninstall-dist_uiDATA uninstall-gnome_abrtexecPYTHON + + .MAKE: $(am__recursive_targets) check-am install-am install-strip + +@@ -756,14 +782,15 @@ + cscopelist-am ctags ctags-am distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ +- install-data-am install-dvi install-dvi-am install-exec \ +- install-exec-am install-gnome_abrtexecPYTHON install-html \ +- install-html-am install-info install-info-am install-man \ +- install-pdf install-pdf-am install-ps install-ps-am \ +- install-strip installcheck installcheck-am installdirs \ +- installdirs-am maintainer-clean maintainer-clean-generic \ +- mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ +- ps ps-am tags tags-am uninstall uninstall-am \ ++ install-data-am install-dist_uiDATA install-dvi install-dvi-am \ ++ install-exec install-exec-am install-gnome_abrtexecPYTHON \ ++ install-html install-html-am install-info install-info-am \ ++ install-man install-pdf install-pdf-am install-ps \ ++ install-ps-am install-strip installcheck installcheck-am \ ++ installdirs installdirs-am maintainer-clean \ ++ maintainer-clean-generic mostlyclean mostlyclean-generic \ ++ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ ++ uninstall-am uninstall-dist_uiDATA \ + uninstall-gnome_abrtexecPYTHON + + +@@ -773,17 +800,10 @@ + __init__.py: __init__.py.in Makefile + sed -e s,\@PACKAGE\@,$(PACKAGE),g \ + -e s,\@VERSION\@,$(VERSION),g \ ++ -e s,\@GNOME_ABRT_UI_DIR\@,$(uidir),g \ + -e s,\@localedir\@,$(localedir),g $< > $@ + +-gnome_abrt_glade.py: oops.glade Makefile +- { \ +- echo '# coding=utf-8'; \ +- echo 'GNOME_ABRT_GLADE_CONTENTS ="\'; \ +- cat oops.glade | sed -e 's/\"/\\\"/g' -e 's/$$/\\/'; \ +- echo '"'; \ +- } >gnome_abrt_glade.py +- +-all-local: __init__.py controller.py gnome_abrt_glade.py ++all-local: __init__.py controller.py + + check-local: $(gnome_abrtexec_PYTHON) + @USE_PYLINT_TRUE@ $(PYLINT) --rcfile=$(top_builddir)/pylintrc $(abs_builddir) +-- +1.8.3.1 diff --git a/gnome-abrt.spec b/gnome-abrt.spec index b6c4680..08cc96a 100644 --- a/gnome-abrt.spec +++ b/gnome-abrt.spec @@ -6,7 +6,7 @@ Name: gnome-abrt Version: 0.3.3 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A utility for viewing problems that have occurred with the system Group: User Interface/Desktops @@ -16,6 +16,7 @@ Source0: https://fedorahosted.org/released/abrt/%{name}-%{version}.tar.gz # Remove with gnome-abrt > 0.3.3 Patch0331: gnome-abrt-0.3.3-expand_list_of_problems.patch +Patch0332: gnome-abrt-0.3.3-fix_locales_handling.patch BuildRequires: intltool BuildRequires: gettext @@ -50,6 +51,7 @@ provides them with convenient way for managing these problems. %prep %setup -q %patch0331 -p 1 +%patch0332 -p 1 %build @@ -95,6 +97,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %doc COPYING %{python_sitearch}/gnome_abrt %{_datadir}/%{name} +%{_datadir}/%{name}/ui %{_bindir}/%{name} %{_datadir}/applications/* %{_datadir}/appdata/* @@ -104,6 +107,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %changelog +* Wed Dec 18 2013 Jakub Filak 0.3.3-3 +- Fix translations + * Mon Nov 04 2013 Jakub Filak 0.3.3-2 - Expand list of problems - Resolves: #1025308