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

URL:		http://mcomix.sourceforge.net/
# Version info: mcomix/mcomixstarter.py
License:	GPLv2+
Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
# 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:	python2-imaging
BuildRequires:	python2-setuptools
BuildRequires:	python2-devel
BuildRequires:	%{_bindir}/desktop-file-install
BuildRequires:	%{_bindir}/appstream-util
# The following BR is really needed for gconf2 macros
BuildRequires:	GConf2
Requires:	pygtk2
Requires:	python2-imaging
Requires:	python2-setuptools
Requires:	python2-subprocess32
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
%patch1 -p1 -b .gettext

# Remove unuseful and invalid entry
sed -i mime/mcomix.appdata.xml \
	-e '\@project_group@d'

%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
%__python2 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%{python2_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

appstream-util validate-relax --nonet \
	$RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml

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%{python2_sitelib}/%{name}/messages/*/ \
	$RPM_BUILD_ROOT%{_datadir}/locale/

%find_lang %{name}

%pre
%gconf_schema_prepare %{name}

%post
%gconf_schema_upgrade %{name}

%preun
%gconf_schema_remove %{name}

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

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

%{_bindir}/%{name}
%{python2_sitelib}/%{name}/
# python-setuptools on F-22 and above "normalizes" version
# like 1.01 -> 1.1
#%%{python_sitelib}/%%{name}-%%{version}-py*.egg-info/
%{python2_sitelib}/%{name}-*-py*.egg-info/

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

%{_datadir}/appdata/%{name}.appdata.xml

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

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


%changelog
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jan 18 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.1-6
- Remove obsolete scriptlets

* Tue Jan 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.2.1-5
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Feb 15 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.2.1-1
- 1.2.1

* Thu Feb  4 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.01-5
- Fix appdata file (remove invalid entry)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.01-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.01-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Feb 13 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.01-2
- Fix path for egg-info

* Fri Feb 13 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.01-1
- 1.01

* Tue Sep 09 2014 Rex Dieter <rdieter@fedoraproject.org> 1.00-4
- update scriptlets (icon/mime mostly)

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.00-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* 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