File deluge.spec of Package deluge

#
# spec file for package deluge
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           deluge
Version:        1.3.12
Release:        0
Summary:        BitTorrent Client
License:        SUSE-GPL-3.0-with-openssl-exception
Group:          Productivity/Networking/File-Sharing
Url:            http://deluge-torrent.org/
Source:         http://download.deluge-torrent.org/source/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM deluge-update_7z_binary.patch
Patch0:         %{name}-update_7z_binary.patch
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  update-desktop-files
Requires:       python-Mako
Requires:       python-Twisted >= 8.1
Requires:       python-chardet
Requires:       python-gtk >= 2.12
Requires:       python-libtorrent-rasterbar >= 0.14
Requires:       python-pyOpenSSL
Requires:       python-setuptools
Requires:       python-xdg
Requires:       xdg-utils
Recommends:     %{name}-lang
Recommends:     python-GeoIP
Recommends:     python-notify
Recommends:     python-pygame
Recommends:     python-service_identity
Recommends:     python-setproctitle
BuildArch:      noarch

%description
Deluge is a Free Software, cross-platform BitTorrent client on
Python and Gtk2 with multiple user interfaces in client/server
model.

%lang_package

%prep
%setup -q
%patch0

%build
python2 setup.py build

%install
python2 setup.py install --root=%{buildroot} --prefix=%{_prefix} --optimize=1

mv -f %{buildroot}%{python_sitelib}/%{name}/i18n/ %{buildroot}%{_datadir}/locale/
ln -s %{_datadir}/locale %{buildroot}%{python_sitelib}/%{name}/i18n

# Add execution bit to scripts with shebangs.
find %{buildroot}%{python_sitelib} -name '*.py' | while read py; do
    if [[ "$(head -c2 "$py"; echo)" == "#!" ]]; then
        chmod a+x "$py"
    fi
done

%fdupes %{buildroot}%{python_sitelib}
%find_lang %{name}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog LICENSE README
%{_bindir}/%{name}*
%{python_sitelib}/%{name}/
%{python_sitelib}/%{name}-*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/pixmaps/%{name}.*
%{_mandir}/man?/%{name}*

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog