From 081886a03385f946ee4bafba522c3d060fd3be2b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 24 Nov 2020 11:13:09 +0000 Subject: [PATCH 1/2] Reinstate use_unicode constructor parameter, but mark it as deprecated This allows existing projects such as sonata and beets to work with version 2, with appropriate deprecation warnings. --- mpd/base.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/mpd/base.py b/mpd/base.py index 478826a..760c5fb 100644 --- a/mpd/base.py +++ b/mpd/base.py @@ -169,10 +169,27 @@ class MPDClientBase(object): subclasses. """ - def __init__(self): + def __init__(self, use_unicode=None): self.iterate = False + if use_unicode is not None: + warnings.warn( + "use_unicode parameter to ``MPDClientBase`` constructor is " + "deprecated", + DeprecationWarning, + stacklevel=2, + ) self._reset() + @property + def use_unicode(self): + warnings.warn( + "``use_unicode`` is deprecated: python-mpd 2.x always uses " + "Unicode", + DeprecationWarning, + stacklevel=2, + ) + return True + @classmethod def add_command(cls, name, callback): raise NotImplementedError( @@ -469,7 +486,14 @@ class MPDClient(MPDClientBase): MPDClientBase._parse_plugins, ] - def __init__(self): + def __init__(self, use_unicode=None): + if use_unicode is not None: + warnings.warn( + "use_unicode parameter to ``MPDClient`` constructor is " + "deprecated", + DeprecationWarning, + stacklevel=2, + ) super(MPDClient, self).__init__() def _reset(self): From 295264af78a5c83f2b3c2f8793192f2b63a66f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 24 Nov 2020 15:41:10 +0100 Subject: [PATCH 2/2] bump 2.0.1 --- doc/changes.rst | 7 +++++++ mpd/base.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/changes.rst b/doc/changes.rst index d770f3f..a7b71cc 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,6 +1,13 @@ python-mpd2 Changes List ======================== +Changes in v2.0.1 +----------------- + +* 2.0.0 also dropped use_unicode parameter with no backwards compatibility. + This versions just deprecates the parameter. + + Changes in v2.0.0 ----------------- diff --git a/mpd/base.py b/mpd/base.py index 760c5fb..fab76fc 100644 --- a/mpd/base.py +++ b/mpd/base.py @@ -26,7 +26,7 @@ # constants ############################################################################### -VERSION = (2, 0, 0) +VERSION = (2, 0, 1) HELLO_PREFIX = "OK MPD " ERROR_PREFIX = "ACK " SUCCESS = "OK"