mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 15:08:40 +00:00
[Core] Fix SimpleNamespace on Python2
This commit is contained in:
parent
25087d3f2d
commit
957cd5dd9c
5 changed files with 24 additions and 4 deletions
|
@ -21,12 +21,15 @@ matrix:
|
||||||
include:
|
include:
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
env: TOX_ENV=py3
|
env: TOX_ENV=py3
|
||||||
- name: Unit tests (libtorrent 1.2)
|
- name: Unit tests - libtorrent 1.2
|
||||||
env: TOX_ENV=py3
|
env: TOX_ENV=py3
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
|
sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
|
||||||
packages: [python3-libtorrent, python3-venv]
|
packages: [python3-libtorrent, python3-venv]
|
||||||
|
- name: Unit tests - Python 2
|
||||||
|
env: TOX_ENV=py27
|
||||||
|
python: 2.7
|
||||||
- if: commit_message =~ SECURITY_TEST
|
- if: commit_message =~ SECURITY_TEST
|
||||||
env: TOX_ENV=security
|
env: TOX_ENV=security
|
||||||
- name: Code linting
|
- name: Code linting
|
||||||
|
@ -44,6 +47,7 @@ addons:
|
||||||
- sourceline: "ppa:libtorrent.org/rc-1.1-daily"
|
- sourceline: "ppa:libtorrent.org/rc-1.1-daily"
|
||||||
- deadsnakes
|
- deadsnakes
|
||||||
packages:
|
packages:
|
||||||
|
- python-libtorrent
|
||||||
- python3-libtorrent
|
- python3-libtorrent
|
||||||
# Install py36 specifically for pre-commit to run black formatter.
|
# Install py36 specifically for pre-commit to run black formatter.
|
||||||
- python3.6
|
- python3.6
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.0.2 (WiP)
|
||||||
|
|
||||||
|
### Core
|
||||||
|
|
||||||
|
- Fix Python 2 compatiblity issue with SimpleNamespace.
|
||||||
|
|
||||||
## 2.0.1 (2019-06-07)
|
## 2.0.1 (2019-06-07)
|
||||||
|
|
||||||
|
### Packaging
|
||||||
|
|
||||||
- Fix setup.py build error without git installed.
|
- Fix setup.py build error without git installed.
|
||||||
|
|
||||||
## 2.0.0 (2019-06-06)
|
## 2.0.0 (2019-06-06)
|
||||||
|
|
|
@ -28,6 +28,14 @@ from deluge.common import decode_bytes
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
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):
|
class AlertManager(component.Component):
|
||||||
"""AlertManager fetches and processes libtorrent alerts"""
|
"""AlertManager fetches and processes libtorrent alerts"""
|
||||||
|
@ -126,7 +134,7 @@ class AlertManager(component.Component):
|
||||||
if log.isEnabledFor(logging.DEBUG):
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
log.debug('Handling alert: %s', alert_type)
|
log.debug('Handling alert: %s', alert_type)
|
||||||
# Copy alert attributes
|
# Copy alert attributes
|
||||||
alert_copy = types.SimpleNamespace(
|
alert_copy = SimpleNamespace(
|
||||||
**{
|
**{
|
||||||
attr: getattr(alert, attr)
|
attr: getattr(alert, attr)
|
||||||
for attr in dir(alert)
|
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.
|
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.
|
- Shiny new logo.
|
||||||
- Multi-user support.
|
- Multi-user support.
|
||||||
- Performance updates to handle thousands of torrents with faster loading times.
|
- Performance updates to handle thousands of torrents with faster loading times.
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -591,7 +591,7 @@ setup(
|
||||||
'Operating System :: POSIX',
|
'Operating System :: POSIX',
|
||||||
'Topic :: Internet',
|
'Topic :: Internet',
|
||||||
],
|
],
|
||||||
python_requires='>=3.5',
|
python_requires='>=2.7',
|
||||||
license='GPLv3+',
|
license='GPLv3+',
|
||||||
cmdclass=cmdclass,
|
cmdclass=cmdclass,
|
||||||
setup_requires=setup_requires,
|
setup_requires=setup_requires,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue