Compare commits

...

8 Commits

Author SHA1 Message Date
612e0061ed Release 2.0.5 2021-12-15 18:48:16 +00:00
2eee7453cb Update Changelog 2021-12-15 18:45:25 +00:00
58cc278145 [i18n] Fix set_language error with empty lang string
The Web server config for language was set to an empty string which
resulted in an warning logged by i18n set_language.

* Changed set_language to ignore empty language string and do nothing.
We don't want to override the user's system language unless actually
specified by the user.
* Improved the translation warning message.
2021-12-15 18:35:50 +00:00
a03e649da6 [Build] Fix WebUI js minifying error
Some users encoutered a bug where WebUI in browser show a white screen,
which indicates a problem with loading javascript files. The problem was
due to closure minifying failure leaving a zero-length deluge-all.js
file which broke the usual fallback mechanism to debug files.

* Fixed usage of ES6 const declaration breaking closure minifying.
* Cleanup minified files upon errors so no zero length files left
* Replaced broken and unmaintained slimit with rjsmin.
* Fixed unable to set dev or debug query args due to request args
requiring bytes.
2021-12-15 09:37:55 +00:00
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
bca0aa3532 [CI] Replace pypi deluge-libtorrent with libtorrent
* Remove certifi since included in requirements.txt
* Remove old travis config
2021-12-12 21:49:31 +00:00
cb588d0205 [Docs] Update release checklist page 2021-12-12 21:43:54 +00:00
2b20e9689b back to development 2021-12-12 19:35:54 +00:00
11 changed files with 65 additions and 136 deletions

View File

@ -78,7 +78,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.6"
python-version: "3.7"
- name: Cache pip
uses: actions/cache@v2
@ -92,8 +92,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel certifi
python -m pip install deluge-libtorrent
python -m pip install --upgrade pip wheel
python -m pip install libtorrent==1.2.*
pip install -r requirements.txt -r requirements-tests.txt
pip install -e .

View File

@ -1,98 +0,0 @@
os: linux
dist: xenial
language: python
python:
# Travis Xenial Python to support system_site_packages
- 3.5_with_system_site_packages
cache: pip
env:
global:
- DISPLAY=:99.0
git:
# Set greater depth to get version from tags.
depth: 1000
jobs:
include:
- name: Unit tests
env: TOX_ENV=py3
#~ - name: Unit tests - libtorrent 1.2
#~ env: TOX_ENV=py3
#~ addons:
#~ apt:
#~ sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
#~ packages: [python3-libtorrent, python3-venv]
- name: Unit tests - Python 2
env: TOX_ENV=py27
python: 2.7_with_system_site_packages
- if: commit_message =~ SECURITY_TEST
env: TOX_ENV=security
- name: Code linting
env: TOX_ENV=lint
python: 3.6
- name: Docs build
env: TOX_ENV=docs
- name: GTK unit tests
env: TOX_ENV=gtkui
- name: Plugins unit tests
env: TOX_ENV=plugins
- name: Windows Unit tests
os: windows
language: shell
before_install:
# Python version must match available deluge-libtorrent
- choco install python --version 3.6.8
- python --version
- python -m pip install --upgrade pip certifi
- python -m pip install deluge-libtorrent
env:
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- TOX_ENV=py3
addons:
apt:
sources:
- sourceline: "ppa:libtorrent.org/rc-1.1-daily"
- deadsnakes
packages:
- python-libtorrent
- python3-libtorrent
# Install py36 specifically for pre-commit to run black formatter.
- python3.6
# Intall python3-venv to provide ensurepip module for tox.
- python3-venv
# Spellchecking
- enchant
# Install dependencies
install:
- pip install tox
# GTKUI tests
- "if [ $TOX_ENV == 'gtkui' ]; then
sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0;
fi"
# Security tests
- "if [ $TOX_ENV == 'security' ]; then
testssl_url=https://github.com/drwetter/testssl.sh/archive/v2.9.5-5.tar.gz;
wget -O- $testssl_url | tar xz
&& mv -t deluge/tests/data testssl.sh-2.9.5-5/testssl.sh testssl.sh-2.9.5-5/etc/;
fi"
before_script:
- export PYTHONPATH=$PYTHONPATH:$PWD
# Verify libtorrent installed and version
- "if [ $TOX_ENV != 'lint' ]; then
python -c 'import libtorrent as lt; print(lt.__version__)';
fi"
# Start xvfb for the GTKUI tests
- "if [ $TOX_ENV == 'gtkui' ]; then
/sbin/start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile /tmp/custom_xvfb_99.pid \
--exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16;
fi"
script:
- tox -e $TOX_ENV

View File

@ -1,5 +1,12 @@
# Changelog
## 2.0.5 (2021-12-15)
### WebUI
- Fix js minifying error resulting in WebUI blank screen.
- Silence erronous missing translations warning.
## 2.0.4 (2021-12-12)
### Packaging

View File

@ -13,7 +13,7 @@ All modules will require the [common](#common) section dependencies.
- [setuptools]
- [intltool] - Optional: Desktop file translation for \*nix.
- [closure-compiler] - Minify javascript (alternative is [slimit])
- [closure-compiler] - Minify javascript (alternative is [rjsmin])
## Common
@ -71,7 +71,7 @@ All modules will require the [common](#common) section dependencies.
[setuptools]: https://setuptools.readthedocs.io/en/latest/
[intltool]: https://freedesktop.org/wiki/Software/intltool/
[closure-compiler]: https://developers.google.com/closure/compiler/
[slimit]: https://slimit.readthedocs.io/en/latest/
[rjsmin]: https://pypi.org/project/rjsmin/
[openssl]: https://www.openssl.org/
[pyopenssl]: https://pyopenssl.org
[twisted]: https://twistedmatrix.com

View File

@ -69,18 +69,21 @@ def set_language(lang):
:param lang: the language, e.g. "en", "de" or "en_GB"
:type lang: str
"""
if not lang:
return
# Necessary to set these environment variables for GtkBuilder
deluge.common.set_env_variable('LANGUAGE', lang) # Windows/Linux
deluge.common.set_env_variable('LANG', lang) # For OSX
translations_path = get_translations_path()
try:
ro = gettext.translation(
'deluge', localedir=translations_path, languages=[lang]
translation = gettext.translation(
'deluge', localedir=get_translations_path(), languages=[lang]
)
ro.install()
except IOError as ex:
log.warning('IOError when loading translations: %s', ex)
except IOError:
log.warning('Unable to find translation (.mo) to set language: %s', lang)
else:
translation.install()
def setup_mock_translation(warn_msg=None):

View File

@ -51,7 +51,7 @@ Deluge.CopyMagnet = Ext.extend(Ext.Window, {
},
show: function (a) {
Deluge.CopyMagnet.superclass.show.call(this);
const torrent = deluge.torrents.getSelected();
var torrent = deluge.torrents.getSelected();
deluge.client.core.get_magnet_uri(torrent.id, {
success: this.onRequestComplete,
scope: this,

View File

@ -592,13 +592,13 @@ class TopLevel(resource.Resource):
uri_false = ('false', 'no', 'off', '0')
debug_arg = None
req_dbg_arg = request.args.get('debug', [b''])[-1].decode().lower()
req_dbg_arg = request.args.get(b'debug', [b''])[-1].decode().lower()
if req_dbg_arg in uri_true:
debug_arg = True
elif req_dbg_arg in uri_false:
debug_arg = False
dev_arg = request.args.get('dev', [b''])[-1].decode().lower() in uri_true
dev_arg = request.args.get(b'dev', [b''])[-1].decode().lower() in uri_true
dev_ver = 'dev' in common.get_version()
script_type = 'normal'

View File

@ -15,7 +15,7 @@
python setup.py sdist bdist_wheel
- Upload to PyPi (currently only accepts `tar.gz`):
- Upload to PyPi (only accepts `tar.gz`):
twine upload dist/deluge-2.0.0.tar.gz dist/deluge-2.0.0-py3-none-any.whl
@ -23,21 +23,26 @@
cd dist; sha256sum deluge-2.0.0.tar.xz > deluge-2.0.0.tar.xz.sha256
- Upload source tarballs and packages to `download.deluge-torrent.org`.
- Upload source tarballs and packages to `ftp-osl.osuosl.org`.
- Ensure file permissions are global readable: `0644`
- Sub-directories correspond to _major.minor_ version e.g. all `2.0.x` patch
releases are stored in `source/2.0`.
- Change release version in `version` files.
- Run `trigger-deluge` to sync OSUOSL FTP site.
- Change release version in `version*` files, create a new version file for
any major releases.
- SSH into OSUOSL FTP site and run `trigger-deluge` to sync files.
- Create packages (Ubuntu, Windows, OSX).
- Ubuntu: <https://code.launchpad.net/~deluge-team/+recipe/stable-releases>
- Ensure launchpad git repo has sync'd to get latest version
- Update version in recipe (reset any dash number to 0)
- Check for new distribution series needing selected.
- Request build for selected series.
## Post-release
- Update with version, hashes and release notes:
- Publish docs on [ReadTheDocs].
- Forum announcement.
- IRC welcome message.
- Publish new docs version on [ReadTheDocs].
- [Wikipedia]
- Close Trac milestone and add new milestone version for future tickets.
- Ensure all stable branch commits are also applied to development branch.

View File

@ -22,11 +22,16 @@ import fnmatch
import os
import subprocess
import sys
from distutils.spawn import find_executable
try:
from shutil import which
except ImportError:
# PY2 Fallback
from distutils.spawn import find_executable as which
closure_cmd = None
for cmd in ['closure-compiler', 'closure']:
if find_executable(cmd):
if which(cmd):
closure_cmd = cmd
break
@ -50,14 +55,14 @@ def minify_closure(file_in, file_out):
return False
# Closure outputs smallest files but it is a java-based command, so have slimit
# Closure outputs smallest files but java-based command, can use rJSmin
# as a python-only fallback.
#
# deluge-all.js: Closure 127K, Slimit: 143K, JSMin: 162K
# deluge-all.js: Closure 131K, rJSmin: 148K
#
if not closure_cmd:
try:
from slimit import minify as minify
from rjsmin import jsmin as minify
except ImportError:
print('Warning: No minifying command found.')
minify = None
@ -119,6 +124,8 @@ def minify_js_dir(source_dir):
print('Minifying %s' % source_dir)
if not minify_file(file_debug_js, file_minified_js):
print('Warning: Failed minifying files %s, debug only' % source_dir)
if os.path.isfile(file_minified_js):
os.remove(file_minified_js)
if __name__ == '__main__':

View File

@ -11,3 +11,4 @@ flake8-comprehensions
flake8-debugger
flake8-mock
flake8-mutable
rjsmin

View File

@ -15,19 +15,23 @@ import glob
import os
import platform
import sys
from distutils import cmd
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.command.install_data import install_data as _install_data
from distutils.spawn import find_executable
from shutil import rmtree
from setuptools import find_packages, setup
from setuptools import Command, find_packages, setup
from setuptools.command.test import test as _test
import msgfmt
from version import get_version
try:
from shutil import which
except ImportError:
# PY2 Fallback
from distutils.spawn import find_executable as which
try:
from sphinx.setup_command import BuildDoc
except ImportError:
@ -72,7 +76,7 @@ class PyTest(_test):
sys.exit(errcode)
class CleanDocs(cmd.Command):
class CleanDocs(Command):
description = 'Clean the documentation build and module rst files'
user_options = []
@ -94,7 +98,7 @@ class CleanDocs(cmd.Command):
os.remove(module)
class BuildWebUI(cmd.Command):
class BuildWebUI(Command):
description = 'Minify WebUI files'
user_options = []
@ -145,7 +149,7 @@ class BuildWebUI(cmd.Command):
create_gettext_js(deluge_all_path)
class CleanWebUI(cmd.Command):
class CleanWebUI(Command):
description = 'Clean the documentation build and rst files'
user_options = []
@ -177,7 +181,7 @@ class CleanWebUI(cmd.Command):
pass
class BuildTranslations(cmd.Command):
class BuildTranslations(Command):
description = 'Compile .po files into .mo files & create .desktop file'
user_options = [
@ -202,7 +206,7 @@ class BuildTranslations(cmd.Command):
basedir = os.path.join(self.build_lib, 'deluge', 'i18n')
intltool_merge = 'intltool-merge'
if not windows_check() and find_executable(intltool_merge):
if not windows_check() and which(intltool_merge):
intltool_merge_opts = '--utf8 --quiet'
for data_file in (desktop_data, appdata_data):
# creates the translated file from .in file.
@ -250,7 +254,7 @@ class BuildTranslations(cmd.Command):
sys.stdout.write('\b\b \nFinished compiling translation files. \n')
class CleanTranslations(cmd.Command):
class CleanTranslations(Command):
description = 'Cleans translations files.'
user_options = [
('all', 'a', 'Remove all build output, not just temporary by-products')
@ -270,7 +274,7 @@ class CleanTranslations(cmd.Command):
os.remove(path)
class BuildPlugins(cmd.Command):
class BuildPlugins(Command):
description = 'Build plugins into .eggs'
user_options = [
@ -314,7 +318,7 @@ class BuildPlugins(cmd.Command):
)
class CleanPlugins(cmd.Command):
class CleanPlugins(Command):
description = 'Cleans the plugin folders'
user_options = [
('all', 'a', 'Remove all build output, not just temporary by-products')
@ -361,7 +365,7 @@ class CleanPlugins(cmd.Command):
os.removedirs(path)
class EggInfoPlugins(cmd.Command):
class EggInfoPlugins(Command):
description = 'Create .egg-info directories for plugins'
user_options = []