[Core] Fix SimpleNamespace on Python2
This commit is contained in:
parent
25087d3f2d
commit
957cd5dd9c
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue