Commit Graph

8692 Commits

Author SHA1 Message Date
Calum Lind bd4a3cba38 [Docs] Update install details and add more pages 2019-05-23 15:41:58 +01:00
Calum Lind 3cfa39a2ad [macOS] Fix GTK windowing issues
On macOS the Quartz windowing is used instead of X11 so make ensure
that the X11 window calls are optional.

Also if gtkosx_application is not available then don't create osxapp.

It would be useful to find out how to pass window timestamps on Quartz.
2019-05-23 13:00:02 +01:00
Calum Lind a3b6d8d8e5 [Appveyor] Switch to Python 3.6
- Change build from Python 2.7 to 3.6 64-bit.
 - Specify py36 for tox since using py3 will choose latest py3 e.g. 3.7!
 - Use python 3.6 libtorrent.pyd build
 - Use pre-installed OpenSSL 1.1 (matches libtorrent build)
 - Add python version output to tox.ini for debugging.
2019-05-23 00:15:49 +01:00
Calum Lind 7e3692bb5a [Docs] Fix missing path in RTD config 2019-05-22 18:01:05 +01:00
Calum Lind aa3a9a15cc [Docs] Update readthedocs config
- Add the missing package install so pkg_resources can find version.
2019-05-22 17:48:33 +01:00
Calum Lind 0f92ea401f [Travis] Remove Python2 tests 2019-05-22 14:14:44 +01:00
Calum Lind 260d55aeae [Travis] Fix getting version from git tags
Travis clones the git repo with a shallow depth and the git describe
command cannot find the version tag. Setting depth to 1000 should be
enough but can be increased if required.

Refs:
  https://docs.travis-ci.com/user/customizing-the-build/#git-clone-depth
  https://stackoverflow.com/a/51727114/175584
2019-05-22 12:12:54 +01:00
Calum Lind a9609a197d [Docs] Fix ReadTheDocs config path 2019-05-22 11:39:37 +01:00
Calum Lind a8fac1381b [Packaging] Cleanup README for Pypi
- Set a minimal Python version 3.5 and remove universal wheels.
- Tidy up the README
- Add Project URL for issues and docs.
2019-05-22 11:15:32 +01:00
Calum Lind 65f6ede8b2 [Docs] Updates and fixes to build on Python 3
- Updates to the sphinx conf
  - Applied Mock fixes to build on Python 3.
  - Group patches at bottom of conf file.
  - Use just a major.minor for version.
  - Specify Sphinx 2.0 version requirement.
- Move requirements.txt to docs dir.
- Add readthedocs config
- Fix docstring code block rst formatting issue.
2019-05-21 15:23:45 +01:00
Serg 515dbcc5d9 Minor updates to log.py 2019-05-20 21:23:20 +01:00
Calum Lind 827987fe7d [GTK] Fix drag and drop files in files_tab
Encoutered an error reordering files by dragging in the files tab:
   TypeError: can't pickle TreePath objects

The issue was get_selected_row  now returns a list of TreePath objects which
cannot be pickled. Also the set_text method only accept unicode text to
pickled bytes cannot be used.

The fix is to convert the TreePaths to strings and use json to encode
the list of strings for set_text.
2019-05-20 21:14:42 +01:00
Calum Lind 1357ca7582 [i18n] Ignore non-translation dirs in get_languages
The `__pycache__` dir was showing up in list of available languages so
ensure only those directories with languages are returned.
2019-05-20 21:02:13 +01:00
Calum Lind 72d363968e [Logging] Fix line numbers missing on Python 3
The findCaller method returns a 4-element tuple on Python 3 whereas it
was a 3-element tuple on Python 2.
2019-05-20 16:49:49 +01:00
Calum Lind c6b6902e9f [Core] Fix prefetch magnets missing trackers
When adding magnets that have been prefetched the tracker details were
lost. A result of returning only the lt.torrent_info.metadata which
does not contain full torrent details, such as trackers.

- Modified torrentmanager prefetch_metadata to return dict instead of
  base64 encoded bencoded metadata dict...
  - Used a namedtuple to ease identifying tuple contents.
  - Updated tests to reflect changes with mock trackers added to
    test_torrent.file.torrent.

- Refactor TorrentInfo to accept dict instead of bytes and add
  a class method to accept metadata dict with lists of trackers.
  - Rename class arg from metainfo to torrent_file, matching
    lt.torrent_info.
  - Rename metadata property to correct name; metainfo.
  - Simplify class variable naming with _filedata and _metainfo for
    torrent file contents encoded and decoded respectively.

- Update GTK Add torrent dialog to pass trackers to TorrentInfo.
2019-05-20 16:49:25 +01:00
Calum Lind 6a5bb44d5b [Core] Write torrent file with full magnet metainfo
The use of torrent_info.metadata misses saves trackers and other torrent
metainfo fields so use lt.create_torrent generate method to create this
data.
2019-05-18 16:15:27 +01:00
Calum Lind cbcf8eb863 [GTK] Fix missing magnet trackers with Add dialog (non-prefetch)
When adding magnets (without prefetch) the trackers were missing.

The issue was that the magnet uri was being xml escaped twice so that
the ampersand was still escaped when passed to core and everything after
the magnet info_hash was ignored.

Also found unneeded call to core.add_torrent_files when only adding
magnets with core.add_torrent_magnet so check torrents_to_add before
calling.
2019-05-18 16:15:27 +01:00
Calum Lind 09cfd9b89e [bencode] Fix unhandled TypeError with string
Passing a non-bencoded dict to bdecode resulted in an unhandled
TypeError.

- Catch TypeError in decode_func.
- Add bdecode tests.
- Replace KeyError and IndexError with base LookupError.
2019-05-18 16:15:27 +01:00
Calum Lind b961e11df6 [GTK] Fix handling failed magnet prefetching in Add dialog
If a torrent already exists when trying to prefetch magnet metadata the
exception is not handled and dialog does not update correctly.
2019-05-18 16:12:08 +01:00
Calum Lind 2ca683e8fe [Daemon] Fix showing translation warning messages
Disable the warn_msg in daemon_entry since the argparse option are all
marked for translation and warnings are being output. The original
intent of this warn_msg was to identify anything in core code that was
incorrectly marked for translation.
2019-05-17 10:32:07 +01:00
Calum Lind fd20addead Raise Twisted minimum version to 17.1
The use of CertificateOptions with raiseMinimumTo requires this new
minimum version so update requirements and documents.
2019-05-17 10:08:48 +01:00
Calum Lind 535b13b5f1 [Plugins] Convert plugins to `deluge_` module prefix convention
This commit reverts namespace for the plugins and uses a module prefix
"deluge_" in it's place. The distribution package name remains the same
for now but will also be considered to use a prefix to help find the
third-party plugins e.g. Deluge-{Plugin} and the pluginmanager will
strip the prefix for displaying.

The change is a result of problems trying to package Deluge with
pyinstaller and the pkg_resources namespaces is not compatible.
Testing alternatives to using the pkgutil or PEP420 (native) namespaces
did not yield any joy either as importing eggs with namespaces does not
work. [1]

At this point importable eggs are considered deprecated but there is no
viable alternative yet. [2]

[1] https://github.com/pypa/packaging-problems/issues/212
[2] https://github.com/pypa/packaging-problems/issues/244
2019-05-15 19:20:08 +01:00
Calum Lind d6a0276a78 Update gitignore file
- pip install creates dist-info directories
- add __pycache__ for compelteness and other byte compiled file types.
2019-05-14 11:48:58 +01:00
Calum Lind 9c0325b129 [Plugins] Remove stray unneeded init files 2019-05-13 18:55:35 +01:00
Konstantin Khukalenko f885edd7fc [Console] Add move completed option to add torrent command
- Added a -m|--move-completed option for specifying a move completed
  path when adding a torrent.
- Re-used existing console test and renamed for generic usage.
- Moved setup_translation to tests.__init__ so it is always setup
  instead of relying on tests.common import.

Closes #2847

Co-authored-by: Calum Lind <calumlind+deluge@gmail.com>
2019-05-11 22:33:18 +01:00
Calum Lind 2b171e58a3 [Web] Fix missing deregister_object
pluginbase has the complementary deregister_object but the actual
method was missing in JSON component.
2019-05-11 21:04:34 +01:00
Calum Lind d417c4b0f9 [Core] Refactor the base argparser and translation code.
- Move baseargparser out of deluge/ui since it is also used by the
  Daemon and could cause packaging issues if UI code is not available.
  - Renamed baseargparser to argparserbase to follow existing Deluge
    naming.
  - Renamed get_version to distinguish from deluge.common.get_version.
- Translation code is usable by more than just the UIs so also move it
  to Deluge namespace and re-use i18n directory and make it a package.
  - Renamed setup_translations to singular as it felt more correct.
  - Renamed set_dummy_trans to be more descriptive.

Closes: #3081
2019-05-11 20:40:20 +01:00
Calum Lind 653f80eac8 [#3250|Console] Fix errors dispaying magnets with no files
Trying to display the files for magnet that has no metadata and thus no
files resulted in `'NoneType' object is not iterable` errors.

Only call file prio update method if we have a list of files.
2019-05-11 19:09:44 +01:00
Calum Lind 76b89a7943 [#3250|Console] Fix unable to remove torrent
Trying to remove a torrent had no effect and resulted in the following
error: `'TorrentList' object has no attribute 'clear_marked'`

 * The clear_marked call needs to be made with torrentview instead.
 * Ensure the popup dialog is closed upon deleting the torrent.
2019-05-11 19:05:42 +01:00
DjLegolas 6ff7a5400f Remove detox development requirement
As of tox 3.7, detox is no longer needed as tox added a native
parallel environment execution.
2019-05-09 12:02:59 +01:00
Calum Lind db021b9f41 [#3244|Web] Add support for accept-encoding header
* Use EncodingResourceWrapper to replace compress function so that the
proper checks for accept-encoding header are made.
* Ensure only text is compressed and images are left uncompressed.
2019-05-09 11:41:00 +01:00
Calum Lind ab4661f6fd [Packaging] Remove distro from setuptool requirements
The distro package is only available for Ubuntu 18.04 onwards so don't
require it as it will runtime error about missing module.
2019-05-09 09:20:29 +01:00
Calum Lind 396cadefda [Tests] Fix console test fail on AppVeyor
Curses is not available on Windows so skip AppVeyor test that errors
with:

    E       NameError: global name 'curses' is not defined
2019-05-08 21:41:28 +01:00
Calum Lind 2296906ed3 [Common] Replace platform.linux_distribution function
As of python 3.5, this function is marked as deprecated.
So, [distro][1] is the one we will use (this package is listed at the
example package in the python's [docs][2]).

[1] https://pypi.org/project/distro/
[2] https://docs.python.org/3/library/platform.html#platform.dist
2019-05-08 21:24:45 +01:00
Calum Lind 1a134cab1b [#3248|Console] Fix not accepting input under Python3
On Python 3 the chr function returns unicode so trying to decode will
result in an error. Applied a workaround to assign without decoding.
2019-05-08 21:02:09 +01:00
Calum Lind 7d67792493 [Lint] Update pre-commit linter versions
- Default to python3.
- Needed to add six to isort config.
2019-05-03 17:50:42 +01:00
Calum Lind 3c18e890e8 [Tests] Fix AttributeError in test_core with Twisted 19
Should be setting header contents to string not ints and latest version
of Twisted raised an error encountering int. Also correct the header
name for setting length.
2019-05-03 15:35:32 +01:00
Calum Lind 615500e6e6 [Plugins] Fix missing deregister for JSON 2019-05-03 14:57:30 +01:00
Calum Lind 1425fe5413 [Tox] Pin pip version to fix PEP517 issues
* Using pyproject.toml for black config pip version 19.1 errors out
   about using editable install with pyproject.toml.
   Workaround is to not use pip 19.1 in tox.
 * Pin to 18.1 to avoid pip-wheel-metadata-folder creation

Ref:
 - https://github.com/pypa/pip/issues/6434
 - https://github.com/pypa/pip/issues/6213
2019-05-03 14:53:34 +01:00
Calum Lind 84643fb6f7 [GTK] Remove running reactor in Gdk thread
The Gdk threading code is causing issue on Windows and this method
of moving the main loop to a thread has been deprecated and advised
against so removing without adding replacement as it currently
only creates one main thread and should still be fine.

If a blocking operation occures and needs solving, see the pygobject
guide for recommened way to use threads in Gtk:

https://pygobject.readthedocs.io/en/latest/guide/threading.html
2019-03-29 15:13:02 +00:00
Calum Lind c8b621172e [Lint] Fix flake8 3.7 warnings
- Fix new flake8 warnings from latest version.
  Note: The `addSlash` variable was orphaned with no reference in
        Twisted or Deluge code so removed.

- Update pre-commit config
  - New pinned versions.
  - Fix prettier output.
  - Use new flake8 hook config and add naming plugin.
2019-03-29 14:27:30 +00:00
Calum Lind 02e07dda2a [Docs] Fix recommonmark monkey patch and pin version
The refactored patch did not work so revert it.

A new release of recommonmark breaks the docs build so pin it to working version.
2019-03-29 14:27:18 +00:00
Calum Lind b2e19561e6 [GTK] Fix file manager window popup behind Deluge
Added 'TIMESTAMP' key to startup-id string for dbus method. Unsure if
this is the correct way to specify startup id but it seems to work.

Recreate the dbus session with each call since if there is an error
with the dbus method then it will crash and subsequent calls will fail
with a cryptic message:

   dbus error the name was not provided by any .service files
2018-11-17 14:36:38 +00:00
Calum Lind 389f4167b2 [i18n] Fix incorrect GB translation 2018-11-17 12:17:30 +00:00
Calum Lind 63cc745f5b [Core|Py3] Fix fastresume data not being loaded
Decode the resume_data dict keys to fix lookups with torrent_id strings
not finding resume_data.
2018-11-17 12:12:55 +00:00
Calum Lind 1a4ac93fbb [Lint] Bump prettier version to 1.15.2 2018-11-16 15:06:30 +00:00
Calum Lind 582f60ea0b [Tests] Fix failing tracker_icons test
Disable the testing with seo.com as the site certificate has expired.

Ideally should not be testing against live sites and instead use request
replay tool such as VCR.py.
2018-11-16 15:06:30 +00:00
Calum Lind 157f6ff62a [WebUI] Catch unhandled 'Bad host id' exception
The bad host id error usually occurs on webui when the 'default_daemon'
key in web.conf does not exist in hostlist.conf.

Added a errback method to output a more useful log message.
2018-11-16 15:06:30 +00:00
Calum Lind bf4244e8b2 [GTK] Fix adding non-ascii torrents and paths on Py2
Added decode_bytes to all widgets returning text to ensure unicode on
Python 2.
2018-11-16 15:06:30 +00:00
Calum Lind 25cfd58792 [GTK] Refactor deluge.common usage 2018-11-16 15:06:30 +00:00