File deluge.spec of Package deluge
#
# spec file for package deluge
#
# Copyright (c) 2025 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%global __requires_exclude typelib\\(GConf|AyatanaAppIndicator3\\)
%{?sle15_python_module_pythons}
%define pythons python311
%define python_for_executables python311
%define _version 2.2
Name: deluge
Version: 2.2.0
Release: 0
Summary: BitTorrent Client
License: SUSE-GPL-3.0-with-openssl-exception
Group: Productivity/Networking/File-Sharing
URL: https://deluge-torrent.org/
Source: %{name}-%{version}.tar.xz
# PATCH-FIX-OPENSUSE deluge-suse-geoip-location.patch -- Point to the right GeoIP.dat location.
Patch0: %{name}-suse-geoip-location.patch
# PATCH-FIX-UPSTREAM deluge-update_7z_binary.patch
Patch1: %{name}-update_7z_binary.patch
BuildRequires: fdupes
BuildRequires: gettext
BuildRequires: gobject-introspection-devel
BuildRequires: hicolor-icon-theme
BuildRequires: intltool
BuildRequires: python-rpm-macros
%if 0%{suse_version} >= 1550
BuildRequires: %{python_module Twisted-tls >= 17.1}
%else
BuildRequires: %{python_module Twisted >= 17.1}
%endif
BuildRequires: %{python_module devel}
#BuildRequires: python311-libtorrent-rasterbar >= 1.2
#BuildRequires: python311-rjsmin
BuildRequires: %{python_module setuptools}
#BuildRequires: python311-slimit
BuildRequires: %{python_module wheel}
BuildRequires: strip-nondeterminism
BuildRequires: update-desktop-files
Requires: python311-Mako
Requires: python311-Pillow
%if 0%{suse_version} >= 1550
Requires: python311-Twisted-tls >= 17.1
%else
Requires: python311-Twisted >= 17.1
%endif
Requires: python311-gobject
Requires: python311-gobject-Gdk
Requires: python311-gobject-cairo
Requires: python311-libtorrent-rasterbar >= 1.2
Requires: python311-pyOpenSSL
Requires: python311-pyxdg
Requires: python311-rencode
Requires: python311-setproctitle
Requires: python311-setuptools
Requires: python311-six
Requires: python311-zope.interface
Requires: xdg-utils
Recommends: %{name}-lang
Recommends: python311-GeoIP
Recommends: python311-Pillow
Recommends: python311-chardet
Recommends: python311-dbus-python
Recommends: python311-distro
Recommends: python311-notify
Recommends: python311-pygame
Recommends: python311-service_identity
Recommends: python311-setproctitle
BuildArch: noarch
%if %{?suse_version} >= 1550
Requires: python311-pycairo
%else
Requires: python311-cairo
%endif
%{?systemd_ordering}
%description
Deluge is a Free Software, cross-platform BitTorrent client on
Python and Gtk3 with multiple user interfaces in client/server
model.
%lang_package
%prep
%autosetup -p1
sed -i '/^#!/d' deluge/path_chooser_common.py deluge/ui/gtk3/path_combo_chooser.py
echo %{version} > RELEASE-VERSION
%build
%python_build
%install
%python_install
%python_expand strip-nondeterminism -t zip %{buildroot}/usr/lib/python%{$python_version}/site-packages/%{name}/plugins/*.egg
install -D -m 644 packaging/systemd/deluged.service %{buildroot}%{_userunitdir}/deluged.service
install -D -m 644 packaging/systemd/deluge-web.service %{buildroot}%{_userunitdir}/deluge-web.service
%python3_fix_shebang
%python_expand %fdupes %{buildroot}/usr/lib/python%{$python_version}/site-packages/
%fdupes %{buildroot}%{_datadir}/icons/hicolor/
%python_expand mv %{buildroot}/usr/lib/python%{$python_version}/site-packages/%{name}/i18n %{buildroot}%{_datadir}/locale
%find_lang %{name}
pushd %{buildroot}%{_datadir}/locale/
%python_expand mkdir %{buildroot}/usr/lib/python%{$python_version}/site-packages/%{name}/i18n/
ls | while read -r f; do
if [[ "$f" == "_current_flavor" ]]; then
continue
elif ( echo "$f" | grep -q '\.py$' ); then
%python_expand mv -f "$f" %{buildroot}/usr/lib/python%{$python_version}/site-packages/%{name}/i18n/
else
%python_expand ln -s "%{_datadir}/locale/$f" "%{buildroot}/usr/lib/python%{$python_version}/site-packages/%{name}/i18n/$f"
fi
done
rm -rf %{buildroot}/usr/share/locale/_current_flavor
popd
%fdupes %{buildroot%}%{_datadir}/icons
%pre
%systemd_user_pre deluged.service deluge-web.service
%post
%systemd_user_post deluged.service deluge-web.service
%preun
%systemd_user_preun deluged.service deluge-web.service
%postun
%systemd_user_postun deluged.service deluge-web.service
%files
%license LICENSE
%doc AUTHORS CHANGELOG.md README.md
%{_bindir}/%{name}*
/usr/lib/python%{python_version}/site-packages/%{name}/
/usr/lib/python%{python_version}/site-packages/%{name}-*
%{_userunitdir}/deluged.service
%{_userunitdir}/deluge-web.service
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_datadir}/icons/hicolor/*/apps/%{name}-panel.*
%{_datadir}/pixmaps/%{name}.*
%{_datadir}/metainfo/%{name}.metainfo.xml
%{_mandir}/man1/%{name}*.1%{?ext_man}
%files lang -f %{name}.lang
%changelog