From c1330087b0352c73d0ea2a3463b3bdda61aeeedc Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Jul 23 2010 06:42:16 +0000 Subject: - F-14: rebuild for python 2.7 --- diff --git a/comix-4.0.3-filechooser.patch b/comix-4.0.3-filechooser.patch deleted file mode 100644 index 7f645c2..0000000 --- a/comix-4.0.3-filechooser.patch +++ /dev/null @@ -1,52 +0,0 @@ -Index: src/filechooser.py -=================================================================== ---- src/filechooser.py (revision 307) -+++ src/filechooser.py (revision 309) -@@ -191,13 +191,16 @@ - self.filechooser.set_filter(filters[ - prefs['last filter in main filechooser']]) - except: -- pass -+ self.filechooser.set_filter(filters[0]) - - def files_chosen(self, paths): - if paths: -- current_filter_index = self.filechooser.list_filters().index( -- self.filechooser.get_filter()) -- prefs['last filter in main filechooser'] = current_filter_index -+ try: # For some reason this fails sometimes (GTK+ bug?) -+ filter_index = self.filechooser.list_filters().index( -+ self.filechooser.get_filter()) -+ prefs['last filter in main filechooser'] = filter_index -+ except: -+ pass - _close_main_filechooser_dialog() - self._window.file_handler.open_file(paths[0]) - else: -@@ -235,8 +238,8 @@ - try: - self.filechooser.set_filter(filters[ - prefs['last filter in library filechooser']]) -- except: -- pass -+ except Exception: -+ self.filechooser.set_filter(filters[1]) - - def _set_collection_name(self, *args): - """Set the text in the ComboBoxEntry to the name of the current -@@ -255,9 +258,12 @@ - else: - prefs['auto add books into collections'] = False - collection_name = None -- current_filter_index = self.filechooser.list_filters().index( -- self.filechooser.get_filter()) -- prefs['last filter in library filechooser'] = current_filter_index -+ try: # For some reason this fails sometimes (GTK+ bug?) -+ filter_index = self.filechooser.list_filters().index( -+ self.filechooser.get_filter()) -+ prefs['last filter in library filechooser'] = filter_index -+ except Exception: -+ pass - close_library_filechooser_dialog() - self._library.add_books(paths, collection_name) - else: diff --git a/comix-4.0.4-archive-directory-removed.patch b/comix-4.0.4-archive-directory-removed.patch new file mode 100644 index 0000000..b248f39 --- /dev/null +++ b/comix-4.0.4-archive-directory-removed.patch @@ -0,0 +1,34 @@ +--- comix-4.0.4/src/filehandler.py.missing 2009-01-12 05:54:42.000000000 +0900 ++++ comix-4.0.4/src/filehandler.py 2010-03-18 02:56:06.000000000 +0900 +@@ -466,7 +466,14 @@ + archive in that archive's directory listing, sorted alphabetically. + """ + arch_dir = os.path.dirname(self._base_path) +- files = os.listdir(arch_dir) ++ # arch_dir may not exist, for example the archive being currently opened ++ # was in somoe removable media. ++ try: ++ files = os.listdir(arch_dir) ++ except OSError: ++ self._window.statusbar.set_message( ++ _('Could not open %s: No such directory.') % arch_dir) ++ return + files.sort(locale.strcoll) + try: + current_index = files.index(os.path.basename(self._base_path)) +@@ -483,7 +490,14 @@ + archive in that archive's directory listing, sorted alphabetically. + """ + arch_dir = os.path.dirname(self._base_path) +- files = os.listdir(arch_dir) ++ # arch_dir may not exist, for example the archive being currently opened ++ # was in somoe removable media. ++ try: ++ files = os.listdir(arch_dir) ++ except OSError: ++ self._window.statusbar.set_message( ++ _('Could not open %s: No such directory.') % arch_dir) ++ return + files.sort(locale.strcoll) + try: + current_index = files.index(os.path.basename(self._base_path)) diff --git a/comix-4.0.4-thumb-imaging_error.patch b/comix-4.0.4-thumb-imaging_error.patch new file mode 100644 index 0000000..8fd790e --- /dev/null +++ b/comix-4.0.4-thumb-imaging_error.patch @@ -0,0 +1,30 @@ +--- comix-4.0.4/mime/comicthumb.debug1 2008-11-10 07:17:46.000000000 +0900 ++++ comix-4.0.4/mime/comicthumb 2010-03-18 17:54:12.000000000 +0900 +@@ -196,6 +196,9 @@ + extractor = Extractor(in_path) + files = extractor.get_files() + chosen = guess_cover(files) ++ # No files may be chosen ++ if not chosen: ++ sys.exit(1) + fd = extractor.extract(chosen) + im = Image.open(fd) + if im.size[0] > im.size[1]: +@@ -206,7 +209,14 @@ + y = size + x = max(1, x) + y = max(1, y) +- im.thumbnail((x, y), Image.ANTIALIAS) +- im = im.convert('RGB') +- im.save(out_path, 'PNG') ++ ++ # FIXME ++ # If some error occurs, simply ignore. ++ try: ++ im.thumbnail((x, y), Image.ANTIALIAS) ++ im = im.convert('RGB') ++ im.save(out_path, 'PNG') ++ except: ++ sys.exit(1) ++ + sys.exit(0) diff --git a/comix.spec b/comix.spec index ea990de..949b8ee 100644 --- a/comix.spec +++ b/comix.spec @@ -7,12 +7,11 @@ %undefine alphatag %define comix4 1 -%undefine ifalpha -%define fedorarel 2 +%define fedorarel 3 Name: comix Version: %{mainver} -Release: %{?ifalpha:0.}%{fedorarel}%{?ifalpha:.%alphatag}%{?dist} +Release: %{?ifalpha:0.}%{fedorarel}%{?ifalpha:.%alphatag}%{?dist}.1 Summary: A user-friendly, customizable image viewer Group: Amusements/Graphics @@ -23,6 +22,12 @@ Source0: %{name}-%{mainver}-%{alphatag}.tar.gz %else Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz %endif +# The directory of the archive being currently opened may not exist +# bug 542752, 555534 +Patch1: comix-4.0.4-archive-directory-removed.patch +# Handle some error cases in comicthumb +# bug 568167, 572434 +Patch2: comix-4.0.4-thumb-imaging_error.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -31,6 +36,8 @@ BuildRequires: pygtk2 BuildRequires: python-imaging BuildRequires: desktop-file-utils BuildRequires: %{_bindir}/jpegtran +# The following BR is really needed for gconf2 macros +BuildRequires: GConf2 Requires: pygtk2 Requires: python-imaging Requires: %{_bindir}/jpegtran @@ -48,6 +55,8 @@ uses GTK+ through the PyGTK bindings. %prep %setup -q -n %{name}-%{version}%{?ifalpha:-%alphatag} +%patch1 -p1 -b .missing +%patch2 -p1 -b .debug1 %{__mkdir_p} TMPBIN cd TMPBIN @@ -79,11 +88,7 @@ done export PATH=$(pwd)/TMPBIN:${PATH} %{__python} install.py \ -%if %{comix4} --dir \ -%else - --installdir \ -%endif $RPM_BUILD_ROOT%{_prefix} \ install @@ -109,21 +114,11 @@ desktop-file-install \ %{__rm} -rf $RPM_BUILD_ROOT %pre -[ "$1" -gt 1 ] || exit 0 - -export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` -gconftool-2 --makefile-uninstall-rule \ - %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null - -# If the schema file has ever been renamed:: -# gconftool-2 --makefile-uninstall-rule \ -# %{_sysconfdir}/gconf/schemas/[OLDNAME].schemas > /dev/null +%gconf_schema_prepare %{name} exit 0 %post -export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` -gconftool-2 --makefile-install-rule \ - %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null +%gconf_schema_upgrade %{name} touch --no-create %{_datadir}/icons/hicolor @@ -133,12 +128,7 @@ update-mime-database %{_datadir}/mime &> /dev/null exit 0 %preun -[ "$1" -eq 0 ] || exit 0 - -export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` -gconftool-2 --makefile-uninstall-rule \ - %{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null - +%gconf_schema_remove %{name} exit 0 %postun @@ -169,22 +159,24 @@ exit 0 %{_mandir}/man1/* %{_datadir}/icons/hicolor/*/apps/%{name}* -%if %{comix4} %{_datadir}/icons/hicolor/*/mimetypes/application-x-*.png -%endif -%if ! %{comix4} -%{_datadir}/pixmaps/%{name}.png -%dir %{_datadir}/pixmaps/%{name} -%{_datadir}/pixmaps/%{name}/*.png -%else %dir %{_datadir}/%{name}/ %{_datadir}/%{name}/images/ %{_datadir}/%{name}/src/ -%endif %changelog +* Fri Jul 23 2010 Mamoru Tasaka +- F-14: rebuild for python 2.7 + +* Thu Mar 18 2010 Mamoru Tasaka - 4.0.4-3 +- Handle the error when the media where opened archive existed + is removed (bug 542752, 555534) +- Handle some error cases in comicthumb (bug 568167, 572434) +- Remove macros no longer used, spec file cleanup +- GConf2 scriptlets update + * Sat Jul 25 2009 Mamoru Tasaka - 4.0.4-2 - F-12: Mass rebuild