Blob Blame History Raw
%global osname  %(cat /etc/redhat-release | awk '{sub(/ release.*/,""); print}')
%global pkgmgr  dnf

%bcond_without  python3

Name:           krop
Version:        0.4.12
Release:        3%{?dist}
Summary:        Tool to crop PDF files with an eye towards eReaders
License:        GPLv3+
URL:            http://arminstraub.com/software/krop
Source0:        http://arminstraub.com/downloads/%{name}/%{name}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib

%if %without python3
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
Requires:       python2-%{name} = %{version}-%{release}
%else
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
Requires:       python3-%{name} = %{version}-%{release}
%endif


%description
Krop is a simple graphical tool to crop the pages of PDF files. A unique feature
of krop is its ability to automatically split pages into subpages to fit the
limited screen size of devices such as eReaders. This is particularly useful, if
your eReader does not support convenient scrolling.

%if %without python3
%package -n python2-%{name}
Summary:    Python2 module for %{name}
Requires:   python-PyPDF2 PyQt4 python-poppler-qt4
%{?python_provide:%python_provide python2-%{name}}

%description -n python2-%{name}
%else
%package -n python3-%{name}
Summary:    Python3 module for %{name}
Requires:   python3-PyPDF2 python3-PyQt4 python3-poppler-qt4
%{?python_provide:%python_provide python3-%{name}}

%description -n python3-%{name}
%endif
%{summary}.


%prep
%setup -q
# In terms of OS available on Koji. "of" is needed since Ubuntu appears as font.
find . -type f -name '*.py' -exec sed -i -e 's/of ubuntu/of %{osname}/Ig' \
 -e 's|apt-get|%{pkgmgr}|g' -e 's|python-pypdf|pyPdf|g' '{}' +

%build
%if %without python3
%py2_build
%else
%py3_build
%endif

%install
%if %without python3
%py2_install
%else
%py3_install
%endif
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{name}.desktop
DESTDIR="%{buildroot}" appstream-util install %{name}.appdata.xml


%check
%if %without python3
%{__python2} setup.py check
%else
%{__python3} setup.py check
%endif
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/*.appdata.xml


%post
update-desktop-database &> /dev/null || :

%postun
update-desktop-database &> /dev/null || :


%files
%doc ChangeLog README
%{_bindir}/%{name}
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop

%if %without python3
%files -n python2-%{name}
%{python2_sitelib}/%{name}-%{version}-py%{python2_version}.egg-info
%{python2_sitelib}/%{name}/
%else
%files -n python3-%{name}
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/%{name}/
%endif
%license LICENSE


%changelog
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

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

* Wed Feb 01 2017 Raphael Groner <projects.rg@smart.ms> - 0.4.12-1
- rhbz#1370721
- build with python3 as upstream fixed
- drop useless build conditionals for rhel
- reference for description and license file only once

* Fri Oct 14 2016 Tomas Hozza <thozza@redhat.com> - 0.4.11-3
- Revert back to Python 2 (#1321376)

* Wed Aug 31 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.11-2
- add license file to subpackages

* Wed Aug 31 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.11-1
- new version
- migrate to python3 and split subpackage for module

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

* Fri Jun 03 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.10-1
- new version

* Fri May 06 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.9-6
- R: python2-pyPDF2 (instead of python-pyPDF2)

* Fri May 06 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.9-5
- revert to python2 because source is not compatible with python3, rhbz#1321376

* Sun Apr 24 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.9-4
- replace shebang for python3, rhbz#1321376

* Fri Mar 25 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.9-3
- revert to Qt4 because python3-poppler-qt5 is not available (yet)
- refactor python runtime needs
- simplify check, no tests for python available

* Fri Mar 25 2016 Raphael Groner <projects.rg@smart.ms> - 0.4.9-2
- port to PyPDF2, Python3, Qt5

* Fri Mar 25 2016 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 0.4.9-1
- Update to 0.4.9 (#1276890)

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

* Thu Jul 16 2015 Christopher Meng <rpm@cicku.me> - 0.4.8-1
- Update to 0.4.8

* Tue Feb 17 2015 Christopher Meng <rpm@cicku.me> - 0.4.7-1
- Update to 0.4.7

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sat May 24 2014 Richard Hughes <richard@hughsie.com> - 0.4.6-1
- Update to 0.4.6

* Sat Mar 01 2014 Christopher Meng <rpm@cicku.me> - 0.4.5-1
- Update to 0.4.5

* Sun Aug 25 2013 Christopher Meng <rpm@cicku.me> - 0.4.4-1
- Update to 0.4.4

* Wed Aug 14 2013 Christopher Meng <rpm@cicku.me> - 0.4.3-1
- Update to 0.4.3
- Correct desktop MIME update script.

* Wed Jul 31 2013 Christopher Meng <rpm@cicku.me> - 0.4.1-1
- Update to 0.4.1

* Sat Nov 12 2011 Christopher Meng <rpm@cicku.me> - 0.3.0-1
- Initial Package.