Commit Graph

265 Commits

Author SHA1 Message Date
Calum Lind e87236514d
[Build] Fix entry point build errors
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
2022-02-06 21:02:43 +00:00
Calum Lind a27a77f8c1
[Windows] Use gui_scripts for web and daemon entry points
Hide the console cmd popup when using deluge-web.exe ordeluged.exe on
Windows.

By using gui_scripts it will disable stdin and stdout for these
executable but there are `-debug` versions available if that is
required.

Ref: https://packaging.python.org/en/latest/specifications/entry-points/#use-for-scripts
2022-02-06 15:15:25 +00:00
tbkizle 540d557cb2
[Common] Add is_interface to validate network interfaces
Libtorrent now supports interface names instead of just IP address so
add new common functions to validate user input.

* Added is_interface that will verify if a libtorrent interface of name
or IP address.
* Added is_interface_name to verify that the name supplied is a valid
network interface name in the operating system.
  On Windows sock.if_nameindex() is only supported on 3.8+ and does not
return a uuid (required by libtorrent) so use ifaddr package. Using git
commit version for ifaddr due to adapter name decode bug in v0.1.7.
On other OSes attempt to use stdlib and fallback to ifaddr if installed
otherwiser return True.
* Added tests for is_interface & is_interface_name
* Updated UIs with change from address to interface
* Updated is_ipv6 and is_ipv4 to used inet_pton; now supported on
Windows.

Ref: https://github.com/pydron/ifaddr/pull/32
Closes: https://github.com/deluge-torrent/deluge/pull/338
2022-01-30 16:13:27 +00:00
DjLegolas ec0bcc11f5
Upgrade codebase with pyupgrade (>=py3.6)
Added pyupgrade utility with manual stage to pre-commit and run on all
files.

Ref: https://github.com/asottile/pyupgrade
Closes: deluge-torrent/deluge#326
2021-12-29 21:51:07 +00:00
DjLegolas 897955f0a1
Remove all Python 2 support
* Removed all __future__ imports from code
* Removed all six dependencies
* Removed all future_builtins imports
* Removed all Python 2 related code

Closes: deluge-torrent/deluge#325
2021-12-28 19:26:38 +00:00
Calum Lind 073bbbc09d
[Packaging] Start replacing deprecated distutils
Working towards removing distutils

> direct usage of distutils is now actively discouraged,
with setuptools being the preferred replacement.

Ref: https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html
2021-12-13 23:57:09 +00:00
Calum Lind 1e6cc03946 [Lint] Fix spelling mistakes
A quick fix of some of the mistakes caught by codespell.
Updated readme with new IRC server

Useful to add it as part of linting checks.
2021-09-21 21:43:53 +01:00
Calum Lind 8fb25f71f3 [Install] Update and fix python optional requirements
* Added required dependency setuptools to install_requires
* Remove optional dependency ipaddress from install_requires
* Created extras_require in setup.py. The optional dependencies should
not be included in install_requires so that users can either install
forked dependencies or remove problematic ones. Updated documentation to
detail how to install these optional dependencies.
* Fixed README badge

Refs:
 * https://dev.deluge-torrent.org/ticket/3470
 * https://dev.deluge-torrent.org/ticket/3282
 * https://dev.deluge-torrent.org/ticket/3353
2021-07-31 22:08:23 +01:00
Calum Lind 8b62e50eb8 [Docs] Add spellchecking with pyenchant
- Use sphinxcontrib.spelling with custom wordlist.
- Skip the checking of the modules documents as they raise
false-positives.
- Add a setup.py spellcheck_docs command.
- Fix spelling and other issues.
- Add a doc favicon.
2019-06-15 21:06:27 +01:00
Calum Lind 957cd5dd9c [Core] Fix SimpleNamespace on Python2 2019-06-08 21:31:49 +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 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 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 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 3b8f71613b [Packaging] Fix deps for win32
- Fixed trying to install py2-ipaddress breaking on Python3.
- Add wheel universal option so Py2 and Py3 wheel built.
2018-11-12 10:10:41 +00:00
Calum Lind b665a4a6f7 [#3211|Packaging] Fix missing tray icon
Fixed not including deluge-panel.png in the packaging install.
2018-11-09 10:40:03 +00:00
Calum Lind e7127637cf [Dependency] Remove bundled rencode 2018-11-02 08:47:57 +00:00
kbdserver a6b47e18c9 Fix package_data namespace in setup.py 2018-11-02 08:45:39 +00:00
Calum Lind 01fafd4fe0 [GTK3] Change module structure from ui/gtkui to ui/gtk3
This moves the directory structure so that there is no conflict with the
old gtk2 UI. Also changes the conf and state files being loaded.
2018-11-02 08:45:39 +00:00
Calum Lind 98051bdea2 [Docs] Move apidoc command to Sphinx config
The apidoc modules were not being generated on ReadTheDocs because
there is no way to run sphinx-apidoc manually.

Moved the running of sphinx-apidoc into conf.py.

Added zope.interface minimum version to fix Readthedocs warning.
2018-11-02 00:21:50 +00:00
Calum Lind 82ecf8a416 [Docs] Reorganise and add sections from wiki
- Change the layout and contents of docs to be better organised and
  follow ideas from: https://www.divio.com/blog/documentation/
- Use markdown for non-technical documents to speed up writing.
- Added new sections and imported documents from Trac wiki.

Build fixes:

- Added a patch to fix recommonmark 0.4 and doc referencing:
    https://github.com/rtfd/recommonmark/issues/93
- Set docs build in tox to Py2.7 since there are problems with autodoc
  mocking multiple inheritance on Python 3 resulting in metaclass errors.
- Supressed warning about `modules.rst` not in the toctree by creating
  a static `modules.rst` with `:orphan:` file directive and add to git.
  Also skip creating this toc file with sphinx-apidoc in setup and tox.
- Simplified finding exported RPC and JSON API methods by adding an
  autodoc custom class directive. Removed unneeded __rpcapi.py.
2018-11-01 17:38:10 +00:00
Calum Lind 5ec6ae3ad0 [Packaging] Minimal requirements for test_requires in setup.py
Remove extra_requires since requirements-*.txt files provides these now
plus the extras_requires is for extras at installation time which does
not apply to docs or dev.

For test_requires include the minimal requirements for pytest to run.
This is not the same as the longer tox test requirements that include
linting, docs etcs.

Fix license field.
2018-10-19 14:14:03 +01:00
Calum Lind c1ddcf6012 [Packaging] Add install_requires to setup.py
- Add an install_requires list to allow dependencies to be automatically
  installed via setuptools or pip installation.
- Needed a workaround for twisted service_identity install.
2018-10-19 14:14:03 +01:00
Calum Lind 85bbdfe143 [Packaging] Cleanup dependencies
- Tweaked the layout a bit with optional part of dependency description.
- Updated descriptions to help understand dependency usage.
- Made intltool and chardet packages optional. This will help with
  installation where these might be missing and are not crucial.
- Remove gettext from dependency as is part of Python.
2018-10-19 14:14:03 +01:00
Calum Lind 91164d8dbf Cleanup and use markdown for source text files
Use markdown to aid readability.

Update the README and use it for the long_description in setup.py
Add detailed requirement information to the DEPENDS files.
2018-10-16 14:59:00 +01:00
Calum Lind ee354eb107 [WebUI] Keep debug js in packaging and fix script lookup
Packaging:

- Decided that the debug files are useful for end-user so keep them in
  package installation. For debug script_type to be usable all debug
  file need to be avaialble so extjs debug files also included.

Script type selection:

- Fixed dev and debug request args to be properly decoded on Python 3,
  otherwise comparison would fail and allowed any case for values.

- Modified the choosing of the script type to pick debug if specified
  as previously always choosing dev type if dev version was True. A rare
  scenario but useful but now debug is used if specified otherwise use dev.

- Changed the order when looking for alternative script types to start
  with dev so that if debug is specified but missing it uses a similar
  script type as previously would fallback to normal which is likely
  undesired.
2018-10-16 11:29:41 +01:00
Calum Lind a8a4fb69c0 [Lint] Exclude js and css from EOF fixer
- When running pre-commit on all files it is picking up minified js and
  css files. Since prettier will format correctly the source files ignore
  them in end-of-file fixer.
- The template files in web docs can be ignored too.
- Removed the unneeded `pre-commit-hooks` dependency as pre-commit
  resolves that itself.
- Include files fixed by pre-commit.
2018-10-05 18:45:37 +01:00
Calum Lind 36606fc448 [Docs] Add markdown support
- Use recommonmark to enable use of markdown files in docs.
- Fix theme not specified
- Remove unused spelling module.
- Cleanup mocking modules in conf so building docs requires only Sphinx.
- Simplify tox section, including use of requirements-docs file. Added
  slimit dependency for sdist-ing deluge package.
2018-10-04 15:53:42 +01:00
Calum Lind b1cdc32f73 [Lint] Use Black to auto-format code
The move to using auto-formatter makes it easier to read, submit and
speeds up development time. https://github.com/ambv/black/

Although I would prefer 79 chars, the default line length of 88 chars
used by black suffices. The flake8 line length remains at 120 chars
since black does not touch comments or docstrings and this will require
another round of fixes.

The only black setting that is not standard is the use of double-quotes
for strings so disabled any formatting of these. Note however that
flake8 will still flag usage of double-quotes. I may change my mind on
double vs single quotes but for now leave them.

A new pyproject.toml file has been created for black configuration.
2018-10-03 15:21:53 +01:00
Calum Lind c3a2c67b98 [Py3] A large set of fixes for tests to pass under Python 3
The usual minor fixes for unicode/bytes for library calls.

The minimum Twisted version is now 16 for Python 3 support so remove old
code and start replacing deprecated methods.

Raised the minimum TLS version to 1.2 for the web server.
2018-06-27 16:41:21 +01:00
Calum Lind d642fa3989 Fix files to pass new Flake8 checkers
Some new flake8 checkers were added so fix these new warnings and
any issues uncovered.

Use add-trailing-comma to fix missing trailing commas. It does not
format it as well as I would like however it was fast to change and
helps with git changes in future.

Removed pylint from tox due to large number of warnings.
2018-06-01 23:41:17 +01:00
Calum Lind bae1647e99 Add Pipenv Pipfile for development
Switching to Pipenv will speed up developement. See the docs for
details on using Pipenv.

 - Added more flake8 checks.
 - Added `detox` for running tests in parallel locally.
2018-06-01 23:41:17 +01:00
Calum Lind 12f7345d0c Use a constant for versions 2017-12-17 11:47:08 +00:00
Calum Lind 6837d83f5b Fix setup.py requiring gen_web_gettext 2017-06-27 15:11:19 +01:00
Calum Lind 0424543e36 Update author details 2017-06-25 19:22:13 +01:00
Calum Lind d0cb45808c Exclude test and plugin files from build dir 2017-06-25 19:22:13 +01:00
Calum Lind fd5833c1d8 Fix build failing on removed icon 2017-06-05 06:37:18 +01:00
Calum Lind 579f56b0bf [Lint] Fix triple-quoted to use double-quotes not single
* according to pep8 triple-quotes should use double-quote.
2017-06-05 00:01:07 +01:00
Calum Lind 8a0b7d970a [#2837] [WebUI] Create gettext.js when building 2017-03-22 12:55:17 +00:00
Calum Lind 4df88c0df3 [UI] Refactor appdata.xml code and markup translatable text 2017-02-23 19:02:32 +00:00
Matthias Mailänder 3529036f55 [UI] Add an appdata.xml file
For Linux software gallery integration.
2017-02-23 19:01:44 +00:00
Calum Lind 0160bb1c91 [Lint] Fix pylint warnings in setup.py 2017-01-26 12:48:52 +00:00
Calum Lind 283ad6137d Fix isfile() typo in setup.py 2017-01-09 18:02:28 +00:00
Calum Lind 9cefbc6e5d [Setup] Refactor BuildWebUI class 2016-11-28 18:59:25 +00:00
Calum Lind 14a5156e15 [Setup] Move package variables to top of file
- Refactor _data_files list so icons paths are auto-generated.
2016-11-28 18:58:45 +00:00
Calum Lind 259c9f11e6 [Setup] Rearrange order of some classes 2016-11-28 17:44:22 +00:00
Calum Lind fd1261ab65 [Setup] Create a CleanTranslations class 2016-11-28 17:44:20 +00:00
Calum Lind a924cb73b0 [Setup] Fix wording and syntax in descriptions 2016-11-28 13:00:24 +00:00
Calum Lind 3cbafec68d [Setup] Move deluge egg-info clean to Clean 2016-11-28 13:00:09 +00:00