From fdda9c8fa538278a92d6c0dbb028c98d4dc412be02f69156e027a2d69babe143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 1 Nov 2018 09:34:46 +0000 Subject: [PATCH] - Version update to 18.9.0: * Fixes for the 3.7 python - Remove merged python37.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=70 --- Twisted-18.7.0.tar.bz2 | 3 - Twisted-18.9.0.tar.bz2 | 3 + python-Twisted.changes | 7 ++ python-Twisted.spec | 3 +- python37.patch | 218 ----------------------------------------- 5 files changed, 11 insertions(+), 223 deletions(-) delete mode 100644 Twisted-18.7.0.tar.bz2 create mode 100644 Twisted-18.9.0.tar.bz2 delete mode 100644 python37.patch diff --git a/Twisted-18.7.0.tar.bz2 b/Twisted-18.7.0.tar.bz2 deleted file mode 100644 index 044eaf0..0000000 --- a/Twisted-18.7.0.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:95ae985716e8107816d8d0df249d558dbaabb677987cc2ace45272c166b267e4 -size 3063847 diff --git a/Twisted-18.9.0.tar.bz2 b/Twisted-18.9.0.tar.bz2 new file mode 100644 index 0000000..b1ed7c6 --- /dev/null +++ b/Twisted-18.9.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:294be2c6bf84ae776df2fc98e7af7d6537e1c5e60a46d33c3ce2a197677da395 +size 3088398 diff --git a/python-Twisted.changes b/python-Twisted.changes index d29b1f9..f3f84dc 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Nov 1 09:21:03 UTC 2018 - Tomáš Chvátal + +- Version update to 18.9.0: + * Fixes for the 3.7 python +- Remove merged python37.patch + ------------------------------------------------------------------- Mon Oct 22 08:48:37 UTC 2018 - Tomáš Chvátal diff --git a/python-Twisted.spec b/python-Twisted.spec index 0dae566..ad9a101 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -20,14 +20,13 @@ %define oldpython python %define modname Twisted Name: python-Twisted -Version: 18.7.0 +Version: 18.9.0 Release: 0 Summary: An asynchronous networking framework written in Python License: MIT Group: Development/Languages/Python URL: http://twistedmatrix.com/ Source: https://files.pythonhosted.org/packages/source/T/Twisted/%{modname}-%{version}.tar.bz2 -Patch0: python37.patch Patch1: skip_MultiCast.patch BuildRequires: %{python_module Automat >= 0.3.0} BuildRequires: %{python_module PyHamcrest >= 1.9.0} diff --git a/python37.patch b/python37.patch deleted file mode 100644 index b62b824..0000000 --- a/python37.patch +++ /dev/null @@ -1,218 +0,0 @@ -diff -up Twisted-18.4.0/src/twisted/conch/manhole.py.966 Twisted-18.4.0/src/twisted/conch/manhole.py ---- Twisted-18.4.0/src/twisted/conch/manhole.py.966 2018-03-26 10:19:31.000000000 +0200 -+++ Twisted-18.4.0/src/twisted/conch/manhole.py 2018-06-30 11:33:16.703721804 +0200 -@@ -19,9 +19,11 @@ from io import BytesIO - from twisted.conch import recvline - - from twisted.internet import defer --from twisted.python.compat import _tokenize -+from twisted.python.compat import _tokenize, _get_async_param - from twisted.python.htmlizer import TokenPrinter - -+ -+ - class FileWrapper: - """ - Minimal write-file-like object. -@@ -151,8 +153,9 @@ class ManholeInterpreter(code.Interactiv - return failure - - -- def write(self, data, async=False): -- self.handler.addOutput(data, async) -+ def write(self, data, isAsync=None, **kwargs): -+ isAsync = _get_async_param(isAsync, **kwargs) -+ self.handler.addOutput(data, isAsync) - - - -@@ -237,14 +240,16 @@ class Manhole(recvline.HistoricRecvLine) - return not w.endswith(b'\n') and not w.endswith(b'\x1bE') - - -- def addOutput(self, data, async=False): -- if async: -+ def addOutput(self, data, isAsync=None, **kwargs): -+ isAsync = _get_async_param(isAsync, **kwargs) -+ if isAsync: - self.terminal.eraseLine() -- self.terminal.cursorBackward(len(self.lineBuffer) + len(self.ps[self.pn])) -+ self.terminal.cursorBackward(len(self.lineBuffer) + -+ len(self.ps[self.pn])) - - self.terminal.write(data) - -- if async: -+ if isAsync: - if self._needsNewline(): - self.terminal.nextLine() - -diff -up Twisted-18.4.0/src/twisted/mail/imap4.py.966 Twisted-18.4.0/src/twisted/mail/imap4.py ---- Twisted-18.4.0/src/twisted/mail/imap4.py.966 2018-03-26 10:19:31.000000000 +0200 -+++ Twisted-18.4.0/src/twisted/mail/imap4.py 2018-06-30 11:33:16.704721802 +0200 -@@ -42,7 +42,7 @@ from twisted.python.compat import ( - _bytesChr, unichr as chr, _b64decodebytes as decodebytes, - _b64encodebytes as encodebytes, - intToBytes, iterbytes, long, nativeString, networkString, unicode, -- _matchingString, _PY3 -+ _matchingString, _PY3, _get_async_param, - ) - from twisted.internet import interfaces - -@@ -1090,8 +1090,9 @@ class IMAP4Server(basic.LineReceiver, po - self._respond(b'NO', tag, message) - - -- def sendUntaggedResponse(self, message, async=False): -- if not async or (self.blocked is None): -+ def sendUntaggedResponse(self, message, isAsync=None, **kwargs): -+ isAsync = _get_async_param(isAsync, **kwargs) -+ if not isAsync or (self.blocked is None): - self._respond(message, None, None) - else: - self._queuedAsync.append(message) -@@ -2497,25 +2498,28 @@ class IMAP4Server(basic.LineReceiver, po - # - def modeChanged(self, writeable): - if writeable: -- self.sendUntaggedResponse(message=b'[READ-WRITE]', async=True) -+ self.sendUntaggedResponse(message=b'[READ-WRITE]', isAsync=True) - else: -- self.sendUntaggedResponse(message=b'[READ-ONLY]', async=True) -+ self.sendUntaggedResponse(message=b'[READ-ONLY]', isAsync=True) - - - def flagsChanged(self, newFlags): - for (mId, flags) in newFlags.items(): - encodedFlags = [networkString(flag) for flag in flags] - msg = intToBytes(mId) + ( -- b' FETCH (FLAGS (' +b' '.join(encodedFlags) + b'))' -+ b' FETCH (FLAGS (' + b' '.join(encodedFlags) + b'))' - ) -- self.sendUntaggedResponse(msg, async=True) -+ self.sendUntaggedResponse(msg, isAsync=True) - - - def newMessages(self, exists, recent): - if exists is not None: -- self.sendUntaggedResponse(intToBytes(exists) + b' EXISTS', async=True) -+ self.sendUntaggedResponse( -+ intToBytes(exists) + b' EXISTS', isAsync=True) - if recent is not None: -- self.sendUntaggedResponse(intToBytes(recent) + b' RECENT', async=True) -+ self.sendUntaggedResponse( -+ intToBytes(recent) + b' RECENT', isAsync=True) -+ - - - TIMEOUT_ERROR = error.TimeoutError() -diff -up Twisted-18.4.0/src/twisted/newsfragments/9384.bugfix.966 Twisted-18.4.0/src/twisted/newsfragments/9384.bugfix ---- Twisted-18.4.0/src/twisted/newsfragments/9384.bugfix.966 2018-06-30 11:33:16.682721845 +0200 -+++ Twisted-18.4.0/src/twisted/newsfragments/9384.bugfix 2018-06-30 11:33:16.706721798 +0200 -@@ -0,0 +1,2 @@ -+Syntax error under Python 3.7 fixed for twisted.conch.manhole and -+twisted.main.imap4. -diff -up Twisted-18.4.0/src/twisted/newsfragments/9384.removal.966 Twisted-18.4.0/src/twisted/newsfragments/9384.removal ---- Twisted-18.4.0/src/twisted/newsfragments/9384.removal.966 2018-06-30 11:33:16.706721798 +0200 -+++ Twisted-18.4.0/src/twisted/newsfragments/9384.removal 2018-06-30 11:33:16.706721798 +0200 -@@ -0,0 +1,4 @@ -+async keyword argument is deprecated in twisted.conch.manhole -+(ManholeInterpreter.write and Manhole.add) and in -+twisted.main.imap4.IMAP4Server.sendUntaggedResponse, -+isAsync keyword argument is introduced instead. -diff -up Twisted-18.4.0/src/twisted/python/compat.py.966 Twisted-18.4.0/src/twisted/python/compat.py ---- Twisted-18.4.0/src/twisted/python/compat.py.966 2018-04-13 15:15:32.000000000 +0200 -+++ Twisted-18.4.0/src/twisted/python/compat.py 2018-06-30 11:33:16.704721802 +0200 -@@ -31,6 +31,7 @@ import struct - import sys - import tokenize - from types import MethodType as _MethodType -+import warnings - - from io import TextIOBase, IOBase - -@@ -833,6 +834,34 @@ except ImportError: - from collections import Sequence - - -+def _get_async_param(isAsync=None, **kwargs): -+ """ -+ Provide a backwards-compatible way to get async param value that does not -+ cause a syntax error under Python 3.7. -+ -+ @param isAsync: isAsync param value (should default to None) -+ @type isAsync: L{bool} -+ -+ @param kwargs: keyword arguments of the caller (only async is allowed) -+ @type kwargs: L{dict} -+ -+ @raise TypeError: Both isAsync and async specified. -+ -+ @return: Final isAsync param value -+ @rtype: L{bool} -+ """ -+ if 'async' in kwargs: -+ warnings.warn( -+ "'async' keyword argument is deprecated, please use isAsync", -+ DeprecationWarning, stacklevel=2) -+ if isAsync is None and 'async' in kwargs: -+ isAsync = kwargs.pop('async') -+ if kwargs: -+ raise TypeError -+ return bool(isAsync) -+ -+ -+ - __all__ = [ - "reraise", - "execfile", -diff -up Twisted-18.4.0/src/twisted/test/test_compat.py.966 Twisted-18.4.0/src/twisted/test/test_compat.py ---- Twisted-18.4.0/src/twisted/test/test_compat.py.966 2018-03-26 10:19:31.000000000 +0200 -+++ Twisted-18.4.0/src/twisted/test/test_compat.py 2018-06-30 11:33:16.706721798 +0200 -@@ -16,7 +16,7 @@ from twisted.python.compat import ( - reduce, execfile, _PY3, _PYPY, comparable, cmp, nativeString, - networkString, unicode as unicodeCompat, lazyByteSlice, reraise, - NativeStringIO, iterbytes, intToBytes, ioType, bytesEnviron, iteritems, -- _coercedUnicode, unichr, raw_input, _bytesRepr -+ _coercedUnicode, unichr, raw_input, _bytesRepr, _get_async_param, - ) - from twisted.python.filepath import FilePath - from twisted.python.runtime import platform -@@ -921,3 +921,37 @@ class FutureBytesReprTests(unittest.Test - ``b`` to the returned repr on both Python 2 and 3. - """ - self.assertEqual(_bytesRepr(b'\x00'), "b'\\x00'") -+ -+ -+ -+class GetAsyncParamTests(unittest.SynchronousTestCase): -+ """ -+ Tests for L{twisted.python.compat._get_async_param} -+ """ -+ -+ def test_get_async_param(self): -+ """ -+ L{twisted.python.compat._get_async_param} uses isAsync by default, -+ or deprecated async keyword argument if isAsync is None. -+ """ -+ self.assertEqual(_get_async_param(isAsync=False), False) -+ self.assertEqual(_get_async_param(isAsync=True), True) -+ self.assertEqual( -+ _get_async_param(isAsync=None, **{'async': False}), False) -+ self.assertEqual( -+ _get_async_param(isAsync=None, **{'async': True}), True) -+ self.assertRaises(TypeError, _get_async_param, False, {'async': False}) -+ -+ -+ def test_get_async_param_deprecation(self): -+ """ -+ L{twisted.python.compat._get_async_param} raises a deprecation -+ warning if async keyword argument is passed. -+ """ -+ self.assertEqual( -+ _get_async_param(isAsync=None, **{'async': False}), False) -+ currentWarnings = self.flushWarnings( -+ offendingFunctions=[self.test_get_async_param_deprecation]) -+ self.assertEqual( -+ currentWarnings[0]['message'], -+ "'async' keyword argument is deprecated, please use isAsync")