File qtqr.spec of Package qtqr

%global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")

Name:    qtqr
Version: 1.2
Release: 1
Summary: GUI that makes easy creating and decoding the QR Codes
Summary(ru_RU.UTF8): Графическая оболочка для создания и распознавания QR-кодов
License: GPLv3
Group:   Graphics
URL:     https://launchpad.net/qr-tools
Source0: https://launchpadlibrarian.net/74904937/qr-tools-%{version}.tar.gz
Source1: %{name}
Source2: %{name}.desktop
Source3: copyright
Source4: qtqr.1.gz
Patch0:  fix_library.patch
BuildRequires: python ImageMagick
Requires:  qrencode zbar-pygtk python-pillow python-qrtools PyQt4
BuildArch: noarch

%description
QtQR is a Qt based software that let's you generate QR Codes easily,
scan an image file for QR Codes and decode them or use your webcam to
scan a printed one.

%package -n python-qrtools
Group:  Development/Python
Summary: Backend module for QtQR

%description -n python-qrtools
Python-qrtools is a backend ("library") for creating and decoding QR
Codes in python. Depends on qrenconde and zbar. You can use it in your
own projects

%prep
%setup -n qr-tools
%patch0 -p1
cp %{S:3} ./

%build

%install
%{__mkdir_p} %{buildroot}%{_bindir} \
			 %{buildroot}%{_datadir}/qt4/translations \
			 %{buildroot}%{_datadir}/applications \
			 %{buildroot}%{python_sitelib} \
			 %{buildroot}%{_mandir}/man1

install -D -m 755 %{S:1} %{buildroot}%{_bindir}/%name
install -D -m 755 %name.py %{buildroot}%{_bindir}/%name.py

install -D -m 644 %{S:2} %{buildroot}%{_datadir}/applications/%name.desktop

for res in 16x16 22x22 24x24 32x32 36x36 48x48 64x64 72x72 96x96; do \
  %{__mkdir_p} %{buildroot}/%{_datadir}/icons/hicolor/${res}/apps
  convert -size 96x96 icon.png -resize ${res} %{buildroot}%{_datadir}/icons/hicolor/${res}/apps/%{name}.png
done;

install -D -m 644 %{name}*.qm %{buildroot}%{_datadir}/qt4/translations/
install -D -m 644 qrtools.py %{buildroot}%{python_sitelib}/

install -D -m 644 %{S:4} %{buildroot}%{_mandir}/man1

%files
%doc copyright LICENCE
%{_mandir}/man1/%{name}.1.gz
%{_bindir}/%{name}*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/applications/%name.desktop
%{_datadir}/qt4/translations/%{name}*.qm

%files -n python-qrtools
%doc copyright LICENCE
%{python_sitelib}/qrtools.*


%changelog
* Sun Aug 04 2013 Muhammad Shaban <Mr.Muhammad@linuxac.org> - 1.2-1
- Initial build

openSUSE Build Service is sponsored by