From 185ddf59214d980902c144072debc235193693f85b5ba1322a1ab4ebdace4e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 11 Oct 2018 09:01:36 +0000 Subject: [PATCH 01/10] - Fix the dependencies to match up upstream setup.py - Run the tests - Add patch to build with python3.7: * python37.patch - Add missing dependency on pyamcrest - Remove unused patch lp1102685.diff OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=62 --- lp1102685.diff | 34 ------- python-Twisted.changes | 10 ++ python-Twisted.spec | 44 ++++++--- python37.patch | 218 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 258 insertions(+), 48 deletions(-) delete mode 100644 lp1102685.diff create mode 100644 python37.patch diff --git a/lp1102685.diff b/lp1102685.diff deleted file mode 100644 index f0e4944..0000000 --- a/lp1102685.diff +++ /dev/null @@ -1,34 +0,0 @@ -=== modified file 'twisted/internet/gireactor.py' -Index: Twisted-15.0.0/twisted/internet/gireactor.py -=================================================================== ---- Twisted-15.0.0.orig/twisted/internet/gireactor.py -+++ Twisted-15.0.0/twisted/internet/gireactor.py -@@ -37,9 +37,12 @@ else: - from twisted.python.modules import theSystemPath - _pygtkcompatPresent = True - try: -- theSystemPath["gi.pygtkcompat"] -+ theSystemPath["pygtkcompat"] - except KeyError: -- _pygtkcompatPresent = False -+ try: -+ theSystemPath["gi.pygtkcompat"] -+ except KeyError: -+ _pygtkcompatPresent = False - - - # Modules that we want to ensure aren't imported if we're on older versions of -@@ -75,8 +78,11 @@ else: - # Newer version of gi, so we can try to initialize compatibility layer; if - # real pygtk was already imported we'll get ImportError at this point - # rather than segfault, so unconditional import is fine. -- import gi.pygtkcompat -- gi.pygtkcompat.enable() -+ try: -+ import pygtkcompat -+ except ImportError: -+ from gi import pygtkcompat -+ pygtkcompat.enable() - # At this point importing gobject will get you gi version, and importing - # e.g. gtk will either fail in non-segfaulty way or use gi version if user - # does gi.pygtkcompat.enable_gtk(). So, no need to prevent imports of diff --git a/python-Twisted.changes b/python-Twisted.changes index 6a9b614..bb1770d 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Oct 11 08:32:44 UTC 2018 - Tomáš Chvátal + +- Fix the dependencies to match up upstream setup.py +- Run the tests +- Add patch to build with python3.7: + * python37.patch +- Add missing dependency on pyamcrest +- Remove unused patch lp1102685.diff + ------------------------------------------------------------------- Tue Jul 17 19:42:41 UTC 2018 - dmueller@suse.com diff --git a/python-Twisted.spec b/python-Twisted.spec index 85ed781..c119164 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -25,32 +25,46 @@ Release: 0 Summary: An asynchronous networking framework written in Python License: MIT Group: Development/Languages/Python -Url: http://twistedmatrix.com/ +URL: http://twistedmatrix.com/ Source: https://files.pythonhosted.org/packages/source/T/Twisted/%{modname}-%{version}.tar.bz2 -# PATCH-FIX-UPSTREAM -- https://twistedmatrix.com/trac/ticket/6280 -Patch0: lp1102685.diff -BuildRequires: %{python_module constantly} +Patch0: python37.patch +BuildRequires: %{python_module Automat >= 0.3.0} +BuildRequires: %{python_module PyHamcrest >= 1.9.0} +BuildRequires: %{python_module appdirs >= 1.4.0} +BuildRequires: %{python_module attrs >= 17.4.0} +BuildRequires: %{python_module constantly >= 15.1} +BuildRequires: %{python_module cryptography >= 1.5} BuildRequires: %{python_module devel} +BuildRequires: %{python_module hyperlink >= 17.1.1} BuildRequires: %{python_module hyperlink} -BuildRequires: %{python_module incremental} +BuildRequires: %{python_module idna >= 0.6} +BuildRequires: %{python_module incremental >= 16.10.1} BuildRequires: %{python_module pyOpenSSL} +BuildRequires: %{python_module pyasn1} +BuildRequires: %{python_module pyserial >= 3.0} BuildRequires: %{python_module pyserial} BuildRequires: %{python_module pytest} +BuildRequires: %{python_module python-subunit} +BuildRequires: %{python_module service_identity} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module zope.interface} +BuildRequires: %{python_module zope.interface >= 4.4.2} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-Automat >= 0.3.0 +Requires: python-PyHamcrest >= 1.9.0 +Requires: python-appdirs >= 1.4.0 +Requires: python-attrs >= 17.4.0 Requires: python-constantly >= 15.1 -Requires: python-cryptography +Requires: python-cryptography >= 1.5 Requires: python-hyperlink >= 17.1.1 +Requires: python-idna >= 0.6 Requires: python-incremental >= 16.10.1 Requires: python-pyOpenSSL >= 16.0.0 Requires: python-pyasn1 Requires: python-pyserial >= 3.0 +Requires: python-service_identity Requires: python-zope.interface >= 4.4.2 Recommends: python-service_identity -BuildRoot: %{_tmppath}/%{name}-%{version}-build %ifpython2 Provides: %{oldpython}-twisted = %{version} Obsoletes: %{oldpython}-twisted < %{version} @@ -93,8 +107,7 @@ This package contains the documentation for python-Twisted %prep %setup -q -n %{modname}-%{version} -#%%patch0 -p1 -#sed -i "1d" twisted/{mail/test/pop3testserver,trial/test/scripttest}.py +%patch0 -p1 %build %python_build @@ -106,7 +119,7 @@ install -dm0755 %{buildroot}%{_mandir}/man1/ install -m0644 docs/*/man/*.1 %{buildroot}%{_mandir}/man1/ # Install man pages find docs -type f -print0 | xargs -0 chmod a-x # Fix doc-file dependency by removing x flags #sed -i "s/\r//" docs/core/howto/listings/udp/{MulticastClient,MulticastServer}.py -%fdupes %{buildroot}%{_prefix} +%python_expand %fdupes %{buildroot}%{$python_sitelib} # Prepare for update-alternatives usage for p in twistd cftp ckeygen conch pyhtmlizer tkconch trial ; do @@ -122,12 +135,15 @@ done # no manpage for twist yet: %python_clone %{buildroot}%{_bindir}/twist +%check +export LANG=en_US.UTF-8 +export PATH=%{buildroot}%{_bindir}:$PATH +%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m twisted.trial twisted + %files -n %{name}-doc -%defattr(-,root,root,-) %doc docs/* %files %{python_files} -%defattr(-,root,root,-) %license LICENSE %doc NEWS.rst README.rst %{_bindir}/*-%{python_bin_suffix} diff --git a/python37.patch b/python37.patch new file mode 100644 index 0000000..b62b824 --- /dev/null +++ b/python37.patch @@ -0,0 +1,218 @@ +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") From 3c33fd9509cf476b61900db8b8b76fb3541de63ac5196b57b038826ab693b762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Sat, 13 Oct 2018 06:23:40 +0000 Subject: [PATCH 02/10] Accepting request 641730 from home:ecsos:branches:devel:languages:python - Add missing Requires. Have retragate test change. OBS-URL: https://build.opensuse.org/request/show/641730 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=63 --- python-Twisted.changes | 5 +++++ python-Twisted.spec | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/python-Twisted.changes b/python-Twisted.changes index bb1770d..82a82d3 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Oct 12 09:06:36 UTC 2018 - ecsos@opensuse.org + +- Add missing Requires. + ------------------------------------------------------------------- Thu Oct 11 08:32:44 UTC 2018 - Tomáš Chvátal diff --git a/python-Twisted.spec b/python-Twisted.spec index c119164..51afd76 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -35,11 +35,11 @@ BuildRequires: %{python_module attrs >= 17.4.0} BuildRequires: %{python_module constantly >= 15.1} BuildRequires: %{python_module cryptography >= 1.5} BuildRequires: %{python_module devel} +BuildRequires: %{python_module h2 >= 3.0} BuildRequires: %{python_module hyperlink >= 17.1.1} -BuildRequires: %{python_module hyperlink} BuildRequires: %{python_module idna >= 0.6} BuildRequires: %{python_module incremental >= 16.10.1} -BuildRequires: %{python_module pyOpenSSL} +BuildRequires: %{python_module pyOpenSSL >= 16.0.0} BuildRequires: %{python_module pyasn1} BuildRequires: %{python_module pyserial >= 3.0} BuildRequires: %{python_module pyserial} @@ -56,6 +56,7 @@ Requires: python-appdirs >= 1.4.0 Requires: python-attrs >= 17.4.0 Requires: python-constantly >= 15.1 Requires: python-cryptography >= 1.5 +Requires: python-h2 >= 3.0 Requires: python-hyperlink >= 17.1.1 Requires: python-idna >= 0.6 Requires: python-incremental >= 16.10.1 @@ -64,7 +65,6 @@ Requires: python-pyasn1 Requires: python-pyserial >= 3.0 Requires: python-service_identity Requires: python-zope.interface >= 4.4.2 -Recommends: python-service_identity %ifpython2 Provides: %{oldpython}-twisted = %{version} Obsoletes: %{oldpython}-twisted < %{version} From 83d0c8223e988505e9f0ff02237c01a7efb0c16bab2b3a3dadea5d89dfb724df Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Oct 2018 13:28:10 +0000 Subject: [PATCH 03/10] - Add BuildRequires python-tz, which seems to be required to test suite to pass. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=64 --- python-Twisted.changes | 6 ++++++ python-Twisted.spec | 1 + 2 files changed, 7 insertions(+) diff --git a/python-Twisted.changes b/python-Twisted.changes index 82a82d3..87a8b11 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Oct 19 13:27:25 UTC 2018 - Matěj Cepl + +- Add BuildRequires python-tz, which seems to be required to test suite + to pass. + ------------------------------------------------------------------- Fri Oct 12 09:06:36 UTC 2018 - ecsos@opensuse.org diff --git a/python-Twisted.spec b/python-Twisted.spec index 51afd76..c0b7a70 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -45,6 +45,7 @@ BuildRequires: %{python_module pyserial >= 3.0} BuildRequires: %{python_module pyserial} BuildRequires: %{python_module pytest} BuildRequires: %{python_module python-subunit} +BuildRequires: %{python_module pytz} BuildRequires: %{python_module service_identity} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module zope.interface >= 4.4.2} From 32da4093579d95adc2ef6954b5f36be836292d515c3abf45e29a167748149661 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Oct 2018 14:04:16 +0000 Subject: [PATCH 04/10] - Also, add skip_MultiCast.patch to skip tests requiring full netrworking stack. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=65 --- python-Twisted.changes | 2 ++ python-Twisted.spec | 3 ++- skip_MultiCast.patch | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 skip_MultiCast.patch diff --git a/python-Twisted.changes b/python-Twisted.changes index 87a8b11..fa1e3f8 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -3,6 +3,8 @@ Fri Oct 19 13:27:25 UTC 2018 - Matěj Cepl - Add BuildRequires python-tz, which seems to be required to test suite to pass. +- Also, add skip_MultiCast.patch to skip tests requiring full + netrworking stack. ------------------------------------------------------------------- Fri Oct 12 09:06:36 UTC 2018 - ecsos@opensuse.org diff --git a/python-Twisted.spec b/python-Twisted.spec index c0b7a70..a4c8b97 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -28,6 +28,7 @@ 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} BuildRequires: %{python_module appdirs >= 1.4.0} @@ -108,7 +109,7 @@ This package contains the documentation for python-Twisted %prep %setup -q -n %{modname}-%{version} -%patch0 -p1 +%autopatch -p1 %build %python_build diff --git a/skip_MultiCast.patch b/skip_MultiCast.patch new file mode 100644 index 0000000..3ad4f62 --- /dev/null +++ b/skip_MultiCast.patch @@ -0,0 +1,10 @@ +--- a/src/twisted/test/test_udp.py ++++ b/src/twisted/test/test_udp.py +@@ -500,6 +500,7 @@ class ReactorShutdownInteractionTests(un + + + ++@unittest.SkipTest("Multicast networking doesn't work with ") + class MulticastTests(unittest.TestCase): + + def setUp(self): From 3f583fbe504a230527273df0cce230677f8ae074fcf0ee8165b54d5b863e7c21 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Oct 2018 14:16:31 +0000 Subject: [PATCH 05/10] Fix syntax error OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=66 --- skip_MultiCast.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skip_MultiCast.patch b/skip_MultiCast.patch index 3ad4f62..0c90083 100644 --- a/skip_MultiCast.patch +++ b/skip_MultiCast.patch @@ -4,7 +4,7 @@ -+@unittest.SkipTest("Multicast networking doesn't work with ") ++@unittest.skip("Multicast networking doesn't work with ") class MulticastTests(unittest.TestCase): def setUp(self): From 9d268435a58b281776834fb5ef1fde5de16896ec77864c98e005a617598ab210 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Oct 2018 14:41:26 +0000 Subject: [PATCH 06/10] Just use plain unittest OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=67 --- skip_MultiCast.patch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/skip_MultiCast.patch b/skip_MultiCast.patch index 0c90083..5fdc183 100644 --- a/skip_MultiCast.patch +++ b/skip_MultiCast.patch @@ -1,10 +1,19 @@ --- a/src/twisted/test/test_udp.py +++ b/src/twisted/test/test_udp.py -@@ -500,6 +500,7 @@ class ReactorShutdownInteractionTests(un +@@ -15,6 +15,8 @@ from twisted.internet.defer import Defer + from twisted.internet import protocol, reactor, error, defer, interfaces, udp + from twisted.python import runtime + ++import unittest as pyunit ++ + + class Mixin: + +@@ -500,6 +502,7 @@ class ReactorShutdownInteractionTests(un -+@unittest.skip("Multicast networking doesn't work with ") ++@pyunit.skip("Multicast networking doesn't work with ") class MulticastTests(unittest.TestCase): def setUp(self): From b96524c75c5447f8cf2d1feda7ba92d0577fd282057b2bfa3f470d1802e1fff3 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Oct 2018 14:59:13 +0000 Subject: [PATCH 07/10] Just raise SkipTest exception and be done with it. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=68 --- skip_MultiCast.patch | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/skip_MultiCast.patch b/skip_MultiCast.patch index 5fdc183..b4fc9ab 100644 --- a/skip_MultiCast.patch +++ b/skip_MultiCast.patch @@ -1,19 +1,10 @@ --- a/src/twisted/test/test_udp.py +++ b/src/twisted/test/test_udp.py -@@ -15,6 +15,8 @@ from twisted.internet.defer import Defer - from twisted.internet import protocol, reactor, error, defer, interfaces, udp - from twisted.python import runtime - -+import unittest as pyunit -+ - - class Mixin: - -@@ -500,6 +502,7 @@ class ReactorShutdownInteractionTests(un - - - -+@pyunit.skip("Multicast networking doesn't work with ") +@@ -503,6 +503,7 @@ class ReactorShutdownInteractionTests(un class MulticastTests(unittest.TestCase): def setUp(self): ++ raise unittest.SkipTest("Multicast networking doesn't work with OBS") + self.server = Server() + self.client = Client() + # multicast won't work if we listen over loopback, apparently From ae49f901fccfd8551aae023ba656366fbdf532f55fec2ca59136f139227858be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 22 Oct 2018 08:57:29 +0000 Subject: [PATCH 08/10] - Do not write bytecode stuff when running the tests OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=69 --- python-Twisted.changes | 5 +++++ python-Twisted.spec | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python-Twisted.changes b/python-Twisted.changes index fa1e3f8..d29b1f9 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Oct 22 08:48:37 UTC 2018 - Tomáš Chvátal + +- Do not write bytecode stuff when running the tests + ------------------------------------------------------------------- Fri Oct 19 13:27:25 UTC 2018 - Matěj Cepl diff --git a/python-Twisted.spec b/python-Twisted.spec index a4c8b97..0dae566 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -121,7 +121,7 @@ install -dm0755 %{buildroot}%{_mandir}/man1/ install -m0644 docs/*/man/*.1 %{buildroot}%{_mandir}/man1/ # Install man pages find docs -type f -print0 | xargs -0 chmod a-x # Fix doc-file dependency by removing x flags #sed -i "s/\r//" docs/core/howto/listings/udp/{MulticastClient,MulticastServer}.py -%python_expand %fdupes %{buildroot}%{$python_sitelib} +%python_expand %fdupes %{buildroot}%{$python_sitearch} # Prepare for update-alternatives usage for p in twistd cftp ckeygen conch pyhtmlizer tkconch trial ; do @@ -140,6 +140,7 @@ done %check export LANG=en_US.UTF-8 export PATH=%{buildroot}%{_bindir}:$PATH +export PYTHONDONTWRITEBYTECODE=1 %python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m twisted.trial twisted %files -n %{name}-doc 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 09/10] - 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") From 42629d8d846e091770cac99749a099e6114a8b2bad8b33785991e9e359374e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 1 Nov 2018 11:11:24 +0000 Subject: [PATCH 10/10] - Add patch openssl111.patch which fixes tests with new pyOpenssl * Asserts changed behaviour OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=71 --- openssl111.patch | 42 ++++++++++++++++++++++++++++++++++++++++++ python-Twisted.changes | 2 ++ python-Twisted.spec | 1 + 3 files changed, 45 insertions(+) create mode 100644 openssl111.patch diff --git a/openssl111.patch b/openssl111.patch new file mode 100644 index 0000000..f4f6f1f --- /dev/null +++ b/openssl111.patch @@ -0,0 +1,42 @@ +Index: Twisted-18.9.0/src/twisted/test/test_sslverify.py +=================================================================== +--- Twisted-18.9.0.orig/src/twisted/test/test_sslverify.py ++++ Twisted-18.9.0/src/twisted/test/test_sslverify.py +@@ -898,21 +898,6 @@ class OpenSSLOptionsTests(OpenSSLOptions + self.assertEqual(opts._cipherString.encode('ascii'), ctx._cipherList) + + +- def test_givesMeaningfulErrorMessageIfNoCipherMatches(self): +- """ +- If there is no valid cipher that matches the user's wishes, +- a L{ValueError} is raised. +- """ +- self.assertRaises( +- ValueError, +- sslverify.OpenSSLCertificateOptions, +- privateKey=self.sKey, +- certificate=self.sCert, +- acceptableCiphers= +- sslverify.OpenSSLAcceptableCiphers.fromOpenSSLCipherString('') +- ) +- +- + def test_honorsAcceptableCiphersArgument(self): + """ + If acceptable ciphers are passed, they are used. +@@ -2706,15 +2691,6 @@ class ExpandCipherStringTests(unittest.T + if skipSSL: + skip = skipSSL + +- def test_doesNotStumbleOverEmptyList(self): +- """ +- If the expanded cipher list is empty, an empty L{list} is returned. +- """ +- self.assertEqual( +- [], +- sslverify._expandCipherString(u'', SSL.SSLv23_METHOD, 0) +- ) +- + + def test_doesNotSwallowOtherSSLErrors(self): + """ diff --git a/python-Twisted.changes b/python-Twisted.changes index f3f84dc..ad9cc04 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -4,6 +4,8 @@ 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 +- Add patch openssl111.patch which fixes tests with new pyOpenssl + * Asserts changed behaviour ------------------------------------------------------------------- Mon Oct 22 08:48:37 UTC 2018 - Tomáš Chvátal diff --git a/python-Twisted.spec b/python-Twisted.spec index ad9a101..772cd55 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -28,6 +28,7 @@ Group: Development/Languages/Python URL: http://twistedmatrix.com/ Source: https://files.pythonhosted.org/packages/source/T/Twisted/%{modname}-%{version}.tar.bz2 Patch1: skip_MultiCast.patch +Patch2: openssl111.patch BuildRequires: %{python_module Automat >= 0.3.0} BuildRequires: %{python_module PyHamcrest >= 1.9.0} BuildRequires: %{python_module appdirs >= 1.4.0}