From 6c8f9ce756982c449cf26b28f994bdbf8d69359c Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 28 Jun 2022 19:08:15 +0100 Subject: [PATCH 1/8] Release 2.1.0 --- CHANGELOG.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e6bfd0e..8f7d29ea6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,14 @@ # Changelog -## 2.1.0 (WIP) +## 2.1.0 (2022-06-28) + +### Breaking changes + +- Python 2 support removed (Python >= 3.6) +- libtorrent minimum requirement increased (>= 1.2). ### Core -- Drop Python 2 support for Python 3 only. -- Set libtorrent minimum required version to 1.2. - Add support for SVG tracker icons. - Fix tracker icon error handling. - Fix cleaning-up tracker icon temp files. From 592b05cd87ad01938175426d19aeb7d5896fa61b Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 28 Jun 2022 22:11:29 +0100 Subject: [PATCH 2/8] back to development --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f7d29ea6..736197c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## unreleased + ## 2.1.0 (2022-06-28) ### Breaking changes From f78506161de1ae6e44c14f0d1c8487889ab06e9c Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 29 Jun 2022 13:58:46 +0100 Subject: [PATCH 3/8] [CI] Fix failing Windows Python 3.10 tests A recent dependency change caused the tests running on GitHub Actions under Python 3.10.5 on Windows to fail when starting pytest run: ... INTERNALERROR> File "", line 123, in acquire INTERNALERROR> KeyError: xxxx The cause seems to have been a newer version of chardet package released recently. * Fixed by pinning chardet to v4 * Also pin Windows version to 2019 to match packaging workflow See-also: https://github.com/deluge-torrent/deluge/actions/runs/2578427588 Issue: https://github.com/chardet/chardet/issues/265 --- .github/workflows/ci.yml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdfebc4c3..82a9fd99a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: path: /cores test-windows: - runs-on: windows-latest + runs-on: windows-2019 strategy: matrix: python-version: ["3.7", "3.10"] diff --git a/requirements.txt b/requirements.txt index 30073fc88..d5498836a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ pyxdg pillow mako setuptools -chardet +chardet==4.0.0 setproctitle pywin32; sys_platform == 'win32' certifi; sys_platform == 'win32' From 94d790c159a06755076d1e8e0d16d40c3305bb07 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 30 Jun 2022 21:47:06 +0100 Subject: [PATCH 4/8] [CI] Bump ifaddr to 0.2.0 With release of ifaddr 0.2.0 no longer need to pin to github commit to resolve Windows decoding issues. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d5498836a..7df660fcf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,4 @@ windows-curses; sys_platform == 'win32' zope.interface>=4.4.2 distro; 'linux' in sys_platform or 'bsd' in sys_platform pygeoip -https://github.com/pydron/ifaddr/archive/37cb5334f392f12811d38d90ec891746e3247c76.zip +ifaddr==0.2.0 From f52cf760e4934f1270c077305a479a9d2ec5fd47 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 3 Jul 2022 09:54:03 +0100 Subject: [PATCH 5/8] Fix missing trackers adding magnets The changes to remove deprecated lt methods didn't account for magnet trackers so magnets are missing trackers when added. Previously the addition of trackers was handled by libtorrent when a url was passed in add_torrent_params. The url parameter is deprecated so instead we need to add both the info_hash and trackers. Trac: https://dev.deluge-torrent.org/ticket/3530 --- deluge/core/torrentmanager.py | 2 +- deluge/tests/test_core.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 4904e94ed..5609df4bd 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -436,8 +436,8 @@ class TorrentManager(component.Component): magnet_info = get_magnet_info(magnet) if magnet_info: add_torrent_params['name'] = magnet_info['name'] + add_torrent_params['trackers'] = list(magnet_info['trackers']) torrent_id = magnet_info['info_hash'] - # Workaround lt 1.2 bug for magnet resume data with no metadata add_torrent_params['info_hash'] = bytes(bytearray.fromhex(torrent_id)) else: raise AddTorrentError( diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py index f1c2e3be8..6a3fb9506 100644 --- a/deluge/tests/test_core.py +++ b/deluge/tests/test_core.py @@ -222,10 +222,15 @@ class TestCore(BaseTestCase): @pytest_twisted.inlineCallbacks def test_add_torrent_magnet(self): info_hash = '60d5d82328b4547511fdeac9bf4d0112daa0ce00' - uri = deluge.common.create_magnet_uri(info_hash) + tracker = 'udp://tracker.example.com' + name = 'test magnet' + uri = deluge.common.create_magnet_uri(info_hash, name=name, trackers=[tracker]) options = {} torrent_id = yield self.core.add_torrent_magnet(uri, options) assert torrent_id == info_hash + torrent_status = self.core.get_torrent_status(torrent_id, ['name', 'trackers']) + assert torrent_status['trackers'][0]['url'] == tracker + assert torrent_status['name'] == name def test_resume_torrent(self): tid1 = self.add_torrent('test.torrent', paused=True) From e120536d8766d07c0ec27accc08a01224e8de1e3 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 8 Jul 2022 08:29:18 +0100 Subject: [PATCH 6/8] Fix parsing magnet with tracker tiers Magnets with trackers specified with tr.x param were not being unquoted so unusable raw tracker string was being set. Fixed by unquoting tracker and adding test See-also: https://dev.deluge-torrent.org/ticket/2716 --- deluge/common.py | 18 ++++++++++-------- deluge/tests/test_common.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/deluge/common.py b/deluge/common.py index 77573ffd7..ecf90a390 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -734,6 +734,8 @@ MAGNET_SCHEME = 'magnet:?' XT_BTIH_PARAM = 'xt=urn:btih:' DN_PARAM = 'dn=' TR_PARAM = 'tr=' +TR_TIER_PARAM = 'tr.' +TR_TIER_REGEX = re.compile(r'^tr.(\d+)=(\S+)') def is_magnet(uri): @@ -776,8 +778,6 @@ def get_magnet_info(uri): """ - tr0_param = 'tr.' - tr0_param_regex = re.compile(r'^tr.(\d+)=(\S+)') if not uri.startswith(MAGNET_SCHEME): return {} @@ -805,12 +805,14 @@ def get_magnet_info(uri): tracker = unquote_plus(param[len(TR_PARAM) :]) trackers[tracker] = tier tier += 1 - elif param.startswith(tr0_param): - try: - tier, tracker = re.match(tr0_param_regex, param).groups() - trackers[tracker] = tier - except AttributeError: - pass + elif param.startswith(TR_TIER_PARAM): + tracker_match = re.match(TR_TIER_REGEX, param) + if not tracker_match: + continue + + tier, tracker = tracker_match.groups() + tracker = unquote_plus(tracker) + trackers[tracker] = int(tier) if info_hash: if not name: diff --git a/deluge/tests/test_common.py b/deluge/tests/test_common.py index e5027ebca..780d368ef 100644 --- a/deluge/tests/test_common.py +++ b/deluge/tests/test_common.py @@ -7,6 +7,7 @@ import os import sys import tarfile +from urllib.parse import quote_plus import pytest @@ -19,6 +20,7 @@ from deluge.common import ( fsize, fspeed, ftime, + get_magnet_info, get_path_size, is_infohash, is_interface, @@ -209,3 +211,16 @@ class TestCommon: if tar_info.name == 'archive_message.txt': result = tar.extractfile(tar_info).read().decode() assert result == 'test' + + def test_get_magnet_info_tiers(self): + tracker1 = 'udp://tracker1.example.com' + tracker2 = 'udp://tracker2.example.com' + magnet = ( + 'magnet:?xt=urn:btih:SU5225URMTUEQLDXQWRB2EQWN6KLTYKN' + f'&tr.1={quote_plus(tracker1)}' + f'&tr.2={quote_plus(tracker2)}' + ) + result = get_magnet_info(magnet) + assert result['info_hash'] == '953bad769164e8482c7785a21d12166f94b9e14d' + assert result['trackers'][tracker1] == 1 + assert result['trackers'][tracker2] == 2 From b64084d248ed1344751ff4908ea9cefff0460d92 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 8 Jul 2022 09:03:31 +0100 Subject: [PATCH 7/8] [Docs] Update changelog and install details --- CHANGELOG.md | 5 +++++ docs/source/intro/01-install.md | 15 ++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 736197c12..11de6f025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## unreleased +### Core + +- Fix missing trackers added via magnet +- Fix handling magnets with tracker tiers + ## 2.1.0 (2022-06-28) ### Breaking changes diff --git a/docs/source/intro/01-install.md b/docs/source/intro/01-install.md index 0d49d82ba..15e99456b 100644 --- a/docs/source/intro/01-install.md +++ b/docs/source/intro/01-install.md @@ -48,9 +48,9 @@ One-click [**Install**](https://dl.flathub.org/repo/appstream/org.deluge_torrent ## Windows -Unfortunately no official installer package currently available. +Download [installer](https://ftp.osuosl.org/pub/deluge/windows/?C=M;O=D) -See [Alternative Installs](#alternative-installs) +Availble for Windows 7, 8 & 10 for both 32-bit and 64-bit OSes. ## macOS @@ -96,15 +96,6 @@ The [development PPA] contains daily builds from the `develop` branch. sudo add-apt-repository -u ppa:deluge-team/develop sudo apt install deluge -### Windows Community - -Due to move to GTK3 and Python 3 and problems with pyinstaller there are only community -created installers available. - -Check sticky topics in [Windows Forum] for latest updates. - -For reference [issue #3201] is tracking progress on an official installer. - ### macOS Community #### Unofficial `.app` packages @@ -138,7 +129,5 @@ sudo port install deluge [development ppa]: https://launchpad.net/~deluge-team/+archive/ubuntu/develop/ [stable ppa]: https://launchpad.net/~deluge-team/+archive/ubuntu/stable/ [homebrew]: https://brew.sh/ -[issue #3201]: https://dev.deluge-torrent.org/ticket/3201 -[windows forum]: https://forum.deluge-torrent.org/viewforum.php?f=12 [macos forum]: https://forum.deluge-torrent.org/viewforum.php?f=13 [depends]: ../depends.md From 05e13a6b203da41eec41a10c17f2aa987aacd1da Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 10 Jul 2022 13:15:45 +0100 Subject: [PATCH 8/8] Release 2.1.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11de6f025..7de306456 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## unreleased +## 2.1.1 (2022-07-10) ### Core