diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2019-06-08 18:23:09 +0200 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2019-06-08 22:31:49 +0200 |
commit | 957cd5dd9c82ddc75d3bb5626057cbee7b059c2c (patch) | |
tree | fdbf0663b4ed92552d7d67c018bc831aee958082 | |
parent | [Docs] Add release notes and update pages (diff) | |
download | deluge-957cd5dd9c82ddc75d3bb5626057cbee7b059c2c.tar.xz deluge-957cd5dd9c82ddc75d3bb5626057cbee7b059c2c.zip |
[Core] Fix SimpleNamespace on Python2
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | deluge/core/alertmanager.py | 10 | ||||
-rw-r--r-- | docs/source/releases/2.0.md | 2 | ||||
-rwxr-xr-x | setup.py | 2 |
5 files changed, 24 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index db6824561..50d60e6f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,12 +21,15 @@ matrix: include: - name: Unit tests env: TOX_ENV=py3 - - name: Unit tests (libtorrent 1.2) + - 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 - if: commit_message =~ SECURITY_TEST env: TOX_ENV=security - name: Code linting @@ -44,6 +47,7 @@ addons: - 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5941b1441..d08c04e9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ # Changelog +## 2.0.2 (WiP) + +### Core + +- Fix Python 2 compatiblity issue with SimpleNamespace. + ## 2.0.1 (2019-06-07) +### Packaging + - Fix setup.py build error without git installed. ## 2.0.0 (2019-06-06) diff --git a/deluge/core/alertmanager.py b/deluge/core/alertmanager.py index bf9f6b4c5..2fe42224d 100644 --- a/deluge/core/alertmanager.py +++ b/deluge/core/alertmanager.py @@ -28,6 +28,14 @@ from deluge.common import decode_bytes log = logging.getLogger(__name__) +try: + SimpleNamespace = types.SimpleNamespace # Python 3.3+ +except AttributeError: + + class SimpleNamespace(object): # Python 2.7 + def __init__(self, **attr): + self.__dict__.update(attr) + class AlertManager(component.Component): """AlertManager fetches and processes libtorrent alerts""" @@ -126,7 +134,7 @@ class AlertManager(component.Component): if log.isEnabledFor(logging.DEBUG): log.debug('Handling alert: %s', alert_type) # Copy alert attributes - alert_copy = types.SimpleNamespace( + alert_copy = SimpleNamespace( **{ attr: getattr(alert, attr) for attr in dir(alert) diff --git a/docs/source/releases/2.0.md b/docs/source/releases/2.0.md index 8f196c654..72d8c8efc 100644 --- a/docs/source/releases/2.0.md +++ b/docs/source/releases/2.0.md @@ -6,7 +6,7 @@ Welcome to the latest release of Deluge, a long time in the making! Some of the highlights since the last major release. -- Migrated to Python 3. +- Migrated to Python 3 with minimal support retained for Python 2.7. - Shiny new logo. - Multi-user support. - Performance updates to handle thousands of torrents with faster loading times. @@ -591,7 +591,7 @@ setup( 'Operating System :: POSIX', 'Topic :: Internet', ], - python_requires='>=3.5', + python_requires='>=2.7', license='GPLv3+', cmdclass=cmdclass, setup_requires=setup_requires, |