Blob Blame History Raw
Name:		mcomix
Version:	1.00
Release:	2%{?dist}
Summary:	User-friendly, customizable image viewer for comic books

Group:		Amusements/Graphics
URL:		http://mcomix.sourceforge.net/
# Version info: mcomix/mcomixstarter.py
License:	GPLv2+
Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
# Fedora specific: on Fedora's rpmbuild the following patch
# is needed
Patch0:		mcomix-0.92-fedora-rpmbuild-gtk.patch
# Fedora specific(?): patch to search default localedir for gettext files
Patch1:		mcomix-0.98-gettext-system-install.patch

BuildArch:	noarch
BuildRequires:	gettext
BuildRequires:	pygtk2
BuildRequires:	python-imaging
BuildRequires:	python-setuptools
BuildRequires:	desktop-file-utils
# The following BR is really needed for gconf2 macros
BuildRequires:	GConf2
Requires:	pygtk2
Requires:	python-imaging
Requires:	python-setuptools
Requires(pre):	GConf2
Requires(preun):	GConf2
Requires(post):	GConf2

%description
MComix is a user-friendly, customizable image viewer. It is specifically
designed to handle comic books, but also serves as a generic viewer. It
reads images in ZIP, RAR, 7Zip or tar archives as well as plain image files. It
is written in Python and uses GTK+ through the PyGTK bindings. 

%prep
%setup -q
%patch0 -p1 -b .rpmbuild
%patch1 -p1 -b .gettext

%build
# save timestamps
sed -i -e 's|shutil.copy|shutil.copy2|' mcomix/main.py

# Rename: comicthumb -> mcomicthumb
find . -name comicthumb\* | while read f
do
	mv $f $(echo $f | sed -e 's|comicthumb|mcomicthumb|')
done
grep -rl comicthumb . | xargs sed -i -e 's|comicthumb|mcomicthumb|g'

# Rename: application-x-foo.png -> application-x-mcomix-foo.png
for f in mime/icons/*/application-x-*.png
do
	mv $f $(echo $f | sed -e 's|application-x|application-x-%{name}|')
done
grep -rl application-x . | while read f
do
	sed -i -e 's|application-x|application-x-%{name}|' $f
done
sed -i -e \
	's|/application@x|/application@x-%{name}|' \
	./mime/comicbook.schemas

# embed Fedora EVR
sed -i -e "/^VERSION/s|^\(.*\)$|\1\nVERSION_fedora = '%{version}-%{release}'|" \
	mcomix/constants.py
sed -i -e "s|constants\.VERSION|constants.VERSION_fedora|" \
	mcomix/about_dialog.py

for dir in mcomix/messages/*/LC*/
do
	msgfmt --statistics -o $dir/mcomix.mo $dir/mcomix.po || \
		rm -f $dir/mcomix.mo
done
	
%install
python setup.py \
	install \
	--root $RPM_BUILD_ROOT

%if 0
# Fix rpmlint on the following file on %%install,
# not on %%prep, %%build
sed -i -e '\@^#!.*%{_bindir}/env@d' \
	$RPM_BUILD_ROOT%{python_sitelib}/%{name}/mcomixstarter.py
%endif

desktop-file-install \
	--delete-original \
	--remove-category Application \
	--dir $RPM_BUILD_ROOT%{_datadir}/applications/ \
	$RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas
install -cpm 644 ./mime/comicbook.schemas \
	$RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas/%{name}.schemas

# gettext catalog files
mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/
mv $RPM_BUILD_ROOT%{python_sitelib}/%{name}/messages/*/ \
	$RPM_BUILD_ROOT%{_datadir}/locale/

%find_lang %{name}

%pre
%gconf_schema_prepare %{name}
exit 0

%post
%gconf_schema_upgrade %{name}

touch --no-create %{_datadir}/icons/hicolor

update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null

exit 0

%preun
%gconf_schema_remove %{name}
exit 0

%postun
update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null

[ $1 -eq 0 ] || exit 0
touch --no-create %{_datadir}/icons/hicolor
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor

exit 0

%posttrans
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
exit 0

%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING ChangeLog README

%{_sysconfdir}/gconf/schemas/%{name}.schemas

%{_bindir}/%{name}
%{python_sitelib}/%{name}/
%{python_sitelib}/%{name}-%{version}-py*.egg-info/

%{_datadir}/applications/%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml

%{_mandir}/man1/mcomix.1*
#%%{_mandir}/man1/mcomicthumb.1*

%{_datadir}/icons/hicolor/*/apps/%{name}*
%{_datadir}/icons/hicolor/*/mimetypes/application-x-*.png


%changelog
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.00-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Apr 28 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.00-1
- 1.00

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Jan 15 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.99-3
- Don't import Image directly and import PIL instead for
  F-19 Pillow conversion
  Patch from Toshio Kuratomi <a.badger@gmail.com>
  (bug 895288)

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.99-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jul 17 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.99-1
- 0.99

* Wed Jun  6 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.98-2
- Fix the direction of gettext catalog path wrt F-17 usrmove

* Fri Apr 13 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.98-1
- 0.98

* Mon Mar  5 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.97.1-1
- 0.97

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.96-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon Dec 26 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.96-1
- 0.96

* Wed Dec 14 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.95-2
- Prevent RuntimeError when terminating mcomix from terminal
  (bug 767300)

* Tue Nov 15 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.95-1
- 0.95
- Require python-setuptools (bug 753961)

* Thu Oct 27 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.94-2
- Fix rpmlint issue

* Mon Oct 10 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.94-1
- 0.94

* Sun Aug 28 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.92-1
- Initial package