We cannot add python 3.6 because there is no precompiled version of it to used.
Therefor, will be using 3.7 as the minimum version in CI.
In addition, dropped version limits from pytest.
The SNI icon test is failing due to seo.com removing their favicon.
A new test to replace it would be needed to check SNI support. Ideally
new tests would not rely on external sites.
This propery cause issue with added extra space in the entries, likely a
minor GTK bug and property being leftover from GTK2 migration. The
default is True and should have no effect since no icon is shown.
A visual problem with the port spin button meant that the port number
was not fully visible in the entry field.
The problem is related to icon activatable property value set to False
when default is True. Although no icon is used is creates a left-hand
5px space in the entry which narrows the available text space and the
entry does not expand to account for this.
Fixed by removing primary_icon_activatable and
secondary_icon_activatable properies so that default values of True is
used.
Files should be installed into /usr/lib/systemd/user/
Unlike the existing service file, this one configures deluge to run as a
desktop session user. The difference between the services files is the
use of multi-user.target in system service which does not exist for user
services so requires default.target.
Including the Slice indicates to the service manager that this is a
background service. This can be used to handle OOM situations, or
prioritising foreground processes. There's no equivalent for system
services.
Refs: https://dev.deluge-torrent.org/ticket/2034
Closes: https://github.com/deluge-torrent/deluge/pull/380
The torrent status num_peers and num_seeds was replaced for session
status keys by accident as part of replacing deprecated session keys
so revert those changes
Ref: 2bd095e5bf
Users with older versions of Twisted <= 21.2 were encoutering the
following error:
File "/home/calum/projects/deluge/deluge/decorators.py", line 191, in activate
d = defer.Deferred.fromCoroutine(self.coro)
builtins.AttributeError: type object 'Deferred' has no attribute 'fromCoroutine'
Fixed by falling back to ensureDeferred since fromCoroutine was
introduced in Twisted 21.2 as a saner name for handling of coroutines.
Ref: https://twistedmatrix.com/trac/ticket/9825
If a libtorrent return type was specified e.g.
def get_lt_status(self) -> 'lt.torrent_status'
Even as a string autodoc_typehints module would raise and error:
Handler <function process_docstring at 0x7f6c16c8ec10> for event 'autodoc-process-docstring' threw an exception (exception: getattr(): attribute name must be string)
This was a result of using a custom mock in Sphinx autodoc config and
this Mock object name or qualname returns an object instead of str.
Testing with putting modules in autodoc_mock_imports again showed no
issues so removing custom mock
Ref: https://github.com/tox-dev/sphinx-autodoc-typehints/issues/220
We should not be mangling the torrent data in the JSON API since this
can have unintended consquences with names and filepaths that can be
edited. If we escape those symbols in the JSON API then the data no
longer matches that stored by core. Therefore shift the encoding to the
client and consider dealing separetely with these entities when the user
first adds a torrent.
* Created a modified htmlEncode in Deluge Formatter based on extjs
method that also encodes single quotes.
* Removed renderers in ListViews since only templates specified via tpl
are used and any render attribute specified was a no-op.
* Removed old buggy escapeHtml
Resolves: https://dev.deluge-torrent.org/ticket/3459
Ref: https://docs.sencha.com/extjs/6.5.3/modern/src/String.js.html#Ext.String-method-htmlEncode
Ref: https://docs.sencha.com/extjs/3.4.0/source/Format.html#Ext-util-Format-method-htmlEncode
Ensure all torrent attributes that might contain malicious HTML entities
are encoded.
By allowing HTML entities to be rendered it enable malicious torrent
files to perform XSS attacks.
Resolves: https://dev.deluge-torrent.org/ticket/3459
Could not see more than one host when connection manager opens so need to
scroll or resize window
Increased default height to now show three hosts when first opens
Closes: https://dev.deluge-torrent.org/ticket/3431
if move_completed is checked/True, options should be updated, not the
other way round
The path was updated the first time the move_completed option is selected
and then ignored on further updated to the path.
Fixed by checking instead if the path has changed.
Closes: https://github.com/deluge-torrent/deluge/pull/374
Notable changes:
* Prettier >=2.3 with more consistent js assignments
* Black now formats docstrings
* Added isort to list of autoformaters
* Update flake8 config for v4
Ref: https://prettier.io/blog/2021/05/09/2.3.0.html
As part of the process of adding support to LT 2.0, we should stop using
all deprecated function, as some (if not all) were removed.
For this process, we should use the LT 1.2 upgrade (guide)[1].
The change includes:
* stop using file entries directly
* start using the torrent handle's set/unset flags
* stop using url key in add_torrent_params (for magnet)
* stop accessing resume_data from save_resume_data_alert
* stop using deprecated session status keys in UI
[1] https://libtorrent.org/upgrade_to_1.2-ref.html
Closes: https://dev.deluge-torrent.org/ticket/3499
Closes: https://github.com/deluge-torrent/deluge/pull/342
Errors were raised when trying to add a new daemon account due to dialog
being destroyed before looking up widget values.
Fixed by saving widget values before destroying.
Refactored code to be simplified with a named tuple for the account
details instead of separate attributes and modernized the preferences
dialog creation and account saving by replacing callback functions.
The tests in connectionmanager for when a host is online are broken
and always considers a host as online.
When an error occurs in e.g. in _on_connect_fail, report_message()
in PopupsHandler expects the message to be string, not a Twisted Failure.
Fix by checking if message is string and log a warning before converting
to string.
Closes: https://github.com/deluge-torrent/deluge/pull/277
Currently, when creating a new plugin, a script for creating
the dev links was created for *NIX systems only.
Now, it will detect the system type and create the correct
script:
Windows: create_dev_links.bat
*NIX: create_dev_links.sh
Closes: https://github.com/deluge-torrent/deluge/pull/257
In a6840296, a refactor to the `config` class was introduced.
The change included an internal wrapper for `reactor.callLater`, for lazy
import, but didn't wrap it correctly and therefor, no args/kwargs were
passed to the wrapped method.
Furthermore, the exception was silently ignored.
This caused changes to be ignored and not applied, including
`preferencesmanager._on_config_value_change` callback.
Closes: https://github.com/deluge-torrent/deluge/pull/372
Our file priority test was using time.sleep to wait until libtorrent
had processed the command. This was sometimes not long enough and the
test would fail. On libtorrent 2.0.3+ there is an alert when the
process has finished, switch to waiting for that in this test to make
the test more consistent. On older libtorrent, make the delay a bit
longer, to try to make the test more consistent there as well.
Closes: https://github.com/deluge-torrent/deluge/pull/373
Standardize docstrings in core.py to google standard.
Remove type hints in docstrings in favor of the ones in method signatures.
Use function signature type hints in autodoc generated docs.
Change Deferred type hints to strings.
Older versions of twisted (<21.7) don't
support generic Deferred type hinting,
this prevents crashes on those versions.
Closes: https://github.com/deluge-torrent/deluge/pull/359
Not all dependencies were installed due to adding a comment in the
middle of the pip install command
Also need to specify Twisted extras to match requirement.txt
A problem with GdkPixbuf loaders on Windows causes a hard crash when
attempting to load ico or gif tracker icons.
Added a workaround by skipping these icon types until a more permanent
solution is found.
Ref: https://dev.deluge-torrent.org/ticket/3501
Fixed a mistake settings entry points in setup.py. Replaced with simpler
logic since gui_scripts only affect Windows.
Fixed entry point changes affecting pyinstaller build
Corrected deluge-web.exe to have no console instead of
deluge-web-debug.exe
Make logging functions synchronous.
They were not calling any async functions, and wrapping them in
maybe_coroutine caused reactor to be imported before gtkui could
install the gtk reactor.
Closes: https://github.com/deluge-torrent/deluge/pull/353
- Clean up callback hell by making more code inline
- Use async/await syntax as it has more modern niceties than inlineCallbacks
- Also gets us closer if we want to transition to asyncio in the future
- `await` is usable in places that `yield` is not. e.g. `return await thething` `func(await thething, 'otherparam')`
- IDEs know async semantics of async/await syntax to help more than with `inlineCallbacks`
- `maybe_coroutine` decorator has nice property (over `ensureDeferred`) that when used in a chain of other coroutines, they won't be wrapped in deferreds on each level, and so traceback will show each `await` call leading to the error.
- All async functions wrapped in `maybe_coroutine` are 100% backwards compatible with a regular Deferred returning function. Whether called from a coroutine or not.
- Use Deferred type hints as strings since older versions of twisted
(<21.7) don't support generic Deferred type hinting.
Added a new Config class parameter `log_mask_funcs` to enable config
instances hide sensitive information that would normally appear in
config debug logs.
Added mask password function to hostlist to replace passwords with '*'s
in logs.
Closes: https://github.com/deluge-torrent/deluge/pull/363
Typing is broken with older versions of Twisted e.g. with v21.2
deluge/deluge/core/core.py", line 404, in Core
) -> defer.Deferred[str]:
TypeError: 'type' object is not subscriptable
Also it might not be compatible with Python 3.6 or 3.7 with use of
certain types such as dict rather than Dict
This reverts commit 4096cdfdfe.
Ref: https://twistedmatrix.com/trac/ticket/9816
Standardize docstrings in core.py to google standard.
Remove type hints in docstrings in favor of the ones in method signatures.
Use function signature type hints in autodoc generated docs.
Closes: https://github.com/deluge-torrent/deluge/pull/359
* Refactored duplication with setting config key and logging
* Simplified lazy importing reactor for callLater. This lazy importing
is required for testing and also prevents Gtk UI lockup if reactor
imported in Config.
* Fixed saving config to file when setting a key that doesn't exist yet.
This was due to returning early in the set_item method.
* Added a `default` arg to set_item to prevent saving to file when only
setting a default value for a key in init.
* Moved casting value to existing key type from set_item to dedicated
function.
Have the log dir be a protected windows folder and Deluge crashes.
Windows blocks access to the dir and so it fails. It will fail trying to write
to any protected folder. Should probably just pass on the error maybe
and maybe log to stdout and log a message saying access was blocked or
something.
.\deluge-debug -L debug -l E:\Documents\deluge.log
...
Failed to execute script 'deluge-debug-script' due to unhandled exception!
Closes: https://dev.deluge-torrent.org/ticket/3502
Closes: https://github.com/deluge-torrent/deluge/pull/358
Fixed crash when sys.stdout was None
When using pythonw on windows, sys.stdout and stdin are None. We had a
legacy unicode_argv handler that was crashing in this instance. Just
removed that, since sys.argv is always unicode on python 3 to fix the
crash.
Closes: https://github.com/deluge-torrent/deluge/pull/361
Convert all the twisted.trial tests to pytest_twisted. Also move off of unittest.TestCase as well. Seems there were several tests which weren't actually testing what they should, and also some code that wasn't doing what the broken test said it should.
Goals:
Remove twisted.trial tests
Move to pytest fixtures, rather than many classess and subclasses with setup and teardown functions
Move away from self.assertX to assert style tests
FIx broken tests
Going forward I think these should be the goals when adding/modifying tests:
* Don't use BaseTest or set_up tear_down methods any more. Fixtures should be used either in the test module/class, or make/improve the ones available in conftest.py
* For sure don't use unittest or twisted.trial, they mess up the pytest stuff.
* Prefer pytest_twisted.ensureDeferred with an async function over inlineCallbacks.
- I think the async function syntax is nicer, and it helps catch silly mistakes, e.g. await None is invalid, but yield None isn't, so if some function returns an unexpected thing we try to await on, it will be caught earlier. (I struggled debugging a test for quite a while, then caught it immediately when switching to the new syntax)
- Once the maybe_coroutine PR goes in, using the async syntax can also improve tracebacks when debugging tests.
Things that should probably be cleaned up going forward:
* Remove BaseTestCase
* Remove the subclasses like DaemonBase in favor of new fixtures.
* I think there are some other utility subclasses that could be removed too
* Perhaps use parameterization in the ui_entry tests, rather that the weird combination of subclasses and the set_var fixture I mixed in.
* Convert some of the callback stuff to pytest_twisted.ensureDeferred tests, just for nicer readability
Details relating to pytest fixtures conftest.py in root dir:
* https://github.com/pytest-dev/pytest/issues/5822#issuecomment-697331920
* https://docs.pytest.org/en/latest/deprecations.html#pytest-plugins-in-non-top-level-conftest-files
Closes: https://github.com/deluge-torrent/deluge/pull/354