From 2a5b031086c23335a80306f1ca86e2b18f0e3e68 Mon Sep 17 00:00:00 2001 From: Michael Cronenworth Date: Sep 06 2020 15:10:29 +0000 Subject: Update Requires and add patch for GTK None Type comparison bug (RHBZ#1812790) --- diff --git a/deluge-2.0.3-gtk-cmp-none-types.patch b/deluge-2.0.3-gtk-cmp-none-types.patch new file mode 100644 index 0000000..95fb3b1 --- /dev/null +++ b/deluge-2.0.3-gtk-cmp-none-types.patch @@ -0,0 +1,85 @@ +From 23a48dd01c86ef01cd1d13371de51247ec9a503b Mon Sep 17 00:00:00 2001 +From: Calum Lind +Date: Mon, 27 Apr 2020 21:41:41 +0100 +Subject: [#3309|GTK] Fix cmp function for None types + +Comparisons on Python 3 are much stricter resulting in the following +error comparing with None: + + TypeError: '>' not supported between instances of 'NoneType' and 'str' + +Fix this by getting the type of the other value and getting it's default +value. +--- + deluge/tests/test_ui_gtk3.py | 34 ++++++++++++++++++++++++++++++++++ + deluge/ui/gtk3/common.py | 13 ++++++++++++- + 2 files changed, 46 insertions(+), 1 deletion(-) + create mode 100644 deluge/tests/test_ui_gtk3.py + +diff --git a/deluge/tests/test_ui_gtk3.py b/deluge/tests/test_ui_gtk3.py +new file mode 100644 +index 0000000..a208bb4 +--- /dev/null ++++ b/deluge/tests/test_ui_gtk3.py +@@ -0,0 +1,34 @@ ++# -*- coding: utf-8 -*- ++# ++# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with ++# the additional special exception to link portions of this program with the OpenSSL library. ++# See LICENSE for more details. ++# ++ ++from __future__ import unicode_literals ++ ++import sys ++ ++import mock ++import pytest ++from twisted.trial import unittest ++ ++ ++@pytest.mark.gtkui ++class GTK3CommonTestCase(unittest.TestCase): ++ def setUp(self): ++ sys.modules['gi.repository'] = mock.MagicMock() ++ ++ def tearDown(self): ++ pass ++ ++ def test_cmp(self): ++ from deluge.ui.gtk3.common import cmp ++ ++ self.assertEqual(cmp(None, None), 0) ++ self.assertEqual(cmp(1, None), 1) ++ self.assertEqual(cmp(0, None), 1) ++ self.assertEqual(cmp(None, 7), -1) ++ self.assertEqual(cmp(None, 'bar'), -1) ++ self.assertEqual(cmp('foo', None), 1) ++ self.assertEqual(cmp('', None), 1) +diff --git a/deluge/ui/gtk3/common.py b/deluge/ui/gtk3/common.py +index 0be3bff..7434172 100644 +--- a/deluge/ui/gtk3/common.py ++++ b/deluge/ui/gtk3/common.py +@@ -42,7 +42,18 @@ def cmp(x, y): + and strictly positive if x > y. + """ + +- return (x > y) - (x < y) ++ try: ++ return (x > y) - (x < y) ++ except TypeError: ++ # Handle NoneType comparison ++ if x is None: ++ if y is None: ++ return 0 ++ return -1 ++ elif y is None: ++ return 1 ++ else: ++ raise + + + def create_blank_pixbuf(size=16): +-- +cgit v1.1 + diff --git a/deluge.spec b/deluge.spec index 87c2545..2bc2be9 100644 --- a/deluge.spec +++ b/deluge.spec @@ -1,6 +1,6 @@ Name: deluge Version: 2.0.3 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A GTK+ BitTorrent client with support for DHT, UPnP, and PEX License: GPLv3 with exceptions URL: http://deluge-torrent.org/ @@ -13,15 +13,18 @@ Source3: deluge-web.service Patch0: deluge-2.0.3-gtk-status.patch # https://git.deluge-torrent.org/deluge/patch/?id=d6c96d629183e8bab2167ef56457f994017e7c85 Patch1: deluge-2.0.3-python38.patch +# https://git.deluge-torrent.org/deluge/patch/?id=23a48dd01c86ef01cd1d13371de51247ec9a503b +Patch2: deluge-2.0.3-gtk-cmp-none-types.patch BuildArch: noarch BuildRequires: desktop-file-utils +BuildRequires: intltool +BuildRequires: libappstream-glib BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-wheel -BuildRequires: intltool BuildRequires: rb_libtorrent-python3 -BuildRequires: libappstream-glib +BuildRequires: systemd-rpm-macros ## add Requires to make into Meta package Requires: %{name}-common = %{version}-%{release} @@ -43,18 +46,9 @@ even from behind a router with virtually zero configuration of port-forwarding. %package common Summary: Files common to Deluge sub packages License: GPLv3 with exceptions -Requires: python3-setuptools -Requires: python3-pyOpenSSL -Requires: python3-chardet -Requires: python3-pygame -Requires: python3-setproctitle -Requires: python3-pyxdg Requires: rb_libtorrent-python3 -Requires: python3-twisted -Requires: python3-GeoIP -Requires: python3-rencode Requires: python3-service-identity - +Recommends: python3-GeoIP %description common Common files needed by the Deluge bittorrent client sub packages @@ -72,6 +66,8 @@ Requires: python3-cairo Requires: python3-gobject Requires: libappindicator-gtk3 Requires: librsvg2 +Recommends: python3-dbus +Recommends: python3-pygame %description gtk Deluge bittorent client GTK graphical user interface @@ -106,10 +102,6 @@ Summary: The Deluge daemon License: GPLv3 with exceptions Requires: %{name}-common = %{version}-%{release} Requires(pre): shadow-utils -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -BuildRequires: systemd %description daemon Files for the Deluge daemon @@ -118,17 +110,17 @@ Files for the Deluge daemon %autosetup -p1 %build -CFLAGS="%{optflags}" %{__python3} setup.py build +%py3_build %install +%py3_install + # http://dev.deluge-torrent.org/ticket/2034 mkdir -p %{buildroot}%{_unitdir} install -m644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}-daemon.service install -m644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}-web.service mkdir -p %{buildroot}/var/lib/%{name} -%{__python3} setup.py install -O1 --skip-build --root %{buildroot} - desktop-file-install \ --dir %{buildroot}%{_datadir}/applications \ --copy-name-to-generic-name \ @@ -191,13 +183,13 @@ popd && mv %{buildroot}/%{name}.lang . %{python3_sitelib}/%{name}/ui/data # if someone decides to only install images %dir %{python3_sitelib}/%{name} -%{_datadir}/icons/hicolor/*/apps/%{name}* -%{_datadir}/pixmaps/%{name}.* %files gtk %{_bindir}/%{name} %{_bindir}/%{name}-gtk %{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}* +%{_datadir}/pixmaps/%{name}.* %{_metainfodir}/%{name}.appdata.xml %{python3_sitelib}/%{name}/ui/gtk3 %{_mandir}/man?/%{name}-gtk* @@ -247,6 +239,10 @@ exit 0 %systemd_postun_with_restart deluge-web.service %changelog +* Tue Aug 18 2020 Michael Cronenworth - 2.0.3-12 +- Restructure Requires +- Add patch for GTK comparing None types (RHBZ#1812790) + * Tue Aug 18 2020 Michael Cronenworth - 2.0.3-11 - Update patch for Python 3.8 compatibility (RHBZ#1868902)