[Python-modules-commits] r26354 - in packages/nevow/trunk/debian (5 files)

bernat at users.alioth.debian.org bernat at users.alioth.debian.org
Sat Nov 2 00:19:35 UTC 2013


    Date: Saturday, November 2, 2013 @ 00:19:31
  Author: bernat
Revision: 26354

Add several patches from trunk to fix FTBFS. Closes: #713079.

Added:
  packages/nevow/trunk/debian/patches/2662-deprecation-warnings.patch
  packages/nevow/trunk/debian/patches/2682-zope-interface-compat.patch
  packages/nevow/trunk/debian/patches/2700-unittests-fix.patch
Modified:
  packages/nevow/trunk/debian/changelog
  packages/nevow/trunk/debian/patches/series

Modified: packages/nevow/trunk/debian/changelog
===================================================================
--- packages/nevow/trunk/debian/changelog	2013-11-01 23:54:47 UTC (rev 26353)
+++ packages/nevow/trunk/debian/changelog	2013-11-02 00:19:31 UTC (rev 26354)
@@ -1,10 +1,15 @@
 nevow (0.10.0-5) UNRELEASED; urgency=low
 
+  [ Jakub Wilk ]
   * Use canonical URIs for Vcs-* fields.
   * Drop obsolete Breaks/Replaces with python2.3-nevow and python2.4-nevow.
 
- -- Jakub Wilk <jwilk at debian.org>  Sat, 08 Jun 2013 18:06:02 +0200
+  [ Vincent Bernat ]
+  * Add patches from trunk to make Nevow work with more recent versions of
+    Twisted. Closes: #713079.
 
+ -- Vincent Bernat <bernat at debian.org>  Sat, 02 Nov 2013 00:45:32 +0100
+
 nevow (0.10.0-4) unstable; urgency=low
 
   * Fix FTBFS because of a failed test. Closes: #625151.

Added: packages/nevow/trunk/debian/patches/2662-deprecation-warnings.patch
===================================================================
--- packages/nevow/trunk/debian/patches/2662-deprecation-warnings.patch	                        (rev 0)
+++ packages/nevow/trunk/debian/patches/2662-deprecation-warnings.patch	2013-11-02 00:19:31 UTC (rev 26354)
@@ -0,0 +1,172 @@
+Author: Jean-Paul Calderone <exarkun at divmod.com>
+Forwarded: not-needed
+Description: Change several uses of deprecated APIs in Nevow to more
+  modern equivalents, eliminating the annoying deprecation warnings
+  when loading nevow.
+
+--- Nevow/formless/annotate.py	2008-03-24 16:27:18 +0000
++++ Nevow/formless/annotate.py	2010-02-06 04:33:05 +0000
+@@ -727,7 +727,7 @@
+     complexType = property(lambda self: _typedInterfaceMetadata.get((self, 'complexType'), True))
+ 
+     def __new__(cls, name, bases, dct):
+-        rv = cls = InterfaceClass.__new__(cls, name, bases, dct)
++        rv = cls = InterfaceClass.__new__(cls)
+         _typedInterfaceMetadata[cls, '__id__'] = nextId()
+         _typedInterfaceMetadata[cls, '__methods__'] = methods = []
+         _typedInterfaceMetadata[cls, '__properties__'] = properties = []
+
+=== modified file 'Nevow/nevow/guard.py'
+--- Nevow/nevow/guard.py	2009-07-06 12:06:26 +0000
++++ Nevow/nevow/guard.py	2010-02-06 04:33:05 +0000
+@@ -12,7 +12,10 @@
+ 
+ import random
+ import time
+-import md5
++try:
++    from hashlib import md5
++except ImportError:
++    from md5 import md5
+ import StringIO
+ 
+ from zope.interface import implements
+@@ -34,7 +37,7 @@
+ 
+ 
+ def _sessionCookie():
+-    return md5.new("%s_%s" % (str(random.random()) , str(time.time()))).hexdigest()
++    return md5("%s_%s" % (str(random.random()) , str(time.time()))).hexdigest()
+ 
+ 
+ class GuardSession(components.Componentized):
+
+=== modified file 'Nevow/nevow/test/test_testutil.py'
+--- Nevow/nevow/test/test_testutil.py	2008-07-15 16:48:30 +0000
++++ Nevow/nevow/test/test_testutil.py	2010-02-06 04:33:05 +0000
+@@ -3,6 +3,8 @@
+ applications.
+ """
+ 
++import sys
++
+ from unittest import TestResult
+ 
+ from twisted.python.filepath import FilePath
+@@ -176,6 +178,9 @@
+         self.case.createSource = lambda testMethod: "throw new TypeError();"
+         self.case.run(result)
+         self.assertEqual(len(result.errors), 1)
++        self.assertTrue(
++            result.errors[0][1].startswith(
++                'Exception: JavaScript interpreter had error exit: '))
+ 
+ 
+     def test_signalledExit(self):
+@@ -183,13 +188,20 @@
+         An error should be reported if the JavaScript interpreter exits because
+         it received a signal.
+         """
++        segfault = FilePath(__file__).sibling('segfault.py')
++
+         def stubFinder():
+-            return FilePath(__file__).sibling('segfault.py').path
++            return sys.executable
++        def stubScript(testModule):
++            return segfault.path
+         self.case.findJavascriptInterpreter = stubFinder
+-        self.case.createSource = lambda testMethod: ""
++        self.case.makeScript = stubScript
+         result = TestResult()
+         self.case.run(result)
+         self.assertEqual(len(result.errors), 1)
++        self.assertEquals(
++            result.errors[0][1],
++            'Exception: JavaScript interpreter exited due to signal 11\n')
+ 
+ 
+     def test_missingJavaScriptClass(self):
+
+=== modified file 'Nevow/nevow/testutil.py'
+--- Nevow/nevow/testutil.py	2009-07-04 00:32:14 +0000
++++ Nevow/nevow/testutil.py	2010-02-06 04:33:05 +0000
+@@ -1,12 +1,10 @@
+-# Copyright (c) 2004 Divmod.
++# -*- test-case-name: nevow.test.test_testutil -*-
++# Copyright (c) 2004-2010 Divmod.
+ # See LICENSE for details.
+ 
+ import os, sys, signal
+ 
+-try:
+-    from popen2 import Popen3
+-except ImportError:
+-    Popen3 = None
++from subprocess import PIPE, Popen
+ 
+ from zope.interface import implements
+ 
+@@ -15,6 +13,7 @@
+ except ImportError:
+     subunit = None
+ 
++from twisted.python.log import msg
+ from twisted.trial.unittest import TestCase as TrialTestCase
+ from twisted.python.components import Componentized
+ from twisted.internet import defer
+@@ -407,8 +406,6 @@
+             raise NotSupported("Could not find JavaScript interpreter")
+         if subunit is None:
+             raise NotSupported("Could not import 'subunit'")
+-        if Popen3 is None:
+-            raise NotSupported("Could not import 'popen2.Popen3'")
+         for name in ['WEXITSTATUS', 'WIFSIGNALED' ,'WTERMSIG']:
+             if getattr(os, name, None) is None:
+                 raise NotSupported("os.%s unavailable" % (name,))
+@@ -497,28 +494,28 @@
+         # However, *run cannot return a Deferred profanity profanity profanity
+         # profanity*, so instead it is *profanity* this:
+         def run():
+-            child = Popen3([js, script])
++            argv = [js, script]
++            msg("Running JavaScript interpreter, argv = %r" % (argv,))
++            child = Popen(argv, stdout=PIPE)
+             while True:
+-                bytes = child.fromchild.read(4096)
++                bytes = child.stdout.read(4096)
+                 if bytes:
+                     protocol.dataReceived(bytes)
+                 else:
+                     break
+-            exitCode = child.wait()
+-            if os.WIFSIGNALED(exitCode):
+-                result.addError(
+-                    self,
+-                    (Exception,
+-                     "JavaScript interpreter exited due to signal %d" % (os.WTERMSIG(exitCode),),
+-                     None))
+-            else:
+-                exitStatus = os.WEXITSTATUS(exitCode)
+-                if exitStatus:
+-                    result.addError(
+-                        self,
+-                        (Exception,
+-                         "JavaScript interpreter had error exit: %d" % (exitStatus,),
+-                         None))
++            returnCode = child.wait()
++            if returnCode < 0:
++                result.addError(
++                    self,
++                    (Exception,
++                     "JavaScript interpreter exited due to signal %d" % (-returnCode,),
++                     None))
++            elif returnCode:
++                result.addError(
++                    self,
++                    (Exception,
++                     "JavaScript interpreter had error exit: %d" % (returnCode,),
++                     None))
+         self._runWithSigchild(run)
+ 
+ 
+

Added: packages/nevow/trunk/debian/patches/2682-zope-interface-compat.patch
===================================================================
--- packages/nevow/trunk/debian/patches/2682-zope-interface-compat.patch	                        (rev 0)
+++ packages/nevow/trunk/debian/patches/2682-zope-interface-compat.patch	2013-11-02 00:19:31 UTC (rev 26354)
@@ -0,0 +1,77 @@
+Author: Tristan Seligmann <mithrandi at mithrandi.net>
+Forwarded: not-needed
+Description: Remove the indirect-attribute trickery in TypedInterface
+  (which no longer works with newer versions of z.i) in favour of
+  setting attributes directly on the interface (which seems to have
+  started working quite some time ago).
+
+--- Nevow/formless/annotate.py	2010-02-06 04:33:05 +0000
++++ Nevow/formless/annotate.py	2011-08-06 17:57:26 +0000
+@@ -677,9 +677,6 @@
+         return None, '\n'.join(docs)
+ 
+ 
+-_typedInterfaceMetadata = {}
+-
+-
+ class MetaTypedInterface(InterfaceClass):
+     """The metaclass for TypedInterface. When TypedInterface is subclassed,
+     this metaclass' __new__ method is invoked. The Typed Binding introspection
+@@ -716,21 +713,14 @@
+     Once the metaclass __new__ is done, the Foo class instance will have three
+     properties, __methods__, __properties__, and __spec__,
+     """
+-    __methods__ = property(lambda self: _typedInterfaceMetadata[self, '__methods__'])
+-    __id__ = property(lambda self: _typedInterfaceMetadata[self, '__id__'])
+-    __properties__ = property(lambda self: _typedInterfaceMetadata[self, '__properties__'])
+-    __spec__ = property(lambda self: _typedInterfaceMetadata[self, '__spec__'])
+-    name = property(lambda self: _typedInterfaceMetadata[self, 'name'])
+-    label = property(lambda self: _typedInterfaceMetadata[self, 'label'])
+-    description = property(lambda self: _typedInterfaceMetadata[self, 'description'])
+-    default = property(lambda self: _typedInterfaceMetadata.get((self, 'default'), 'DEFAULT'))
+-    complexType = property(lambda self: _typedInterfaceMetadata.get((self, 'complexType'), True))
+ 
+     def __new__(cls, name, bases, dct):
+         rv = cls = InterfaceClass.__new__(cls)
+-        _typedInterfaceMetadata[cls, '__id__'] = nextId()
+-        _typedInterfaceMetadata[cls, '__methods__'] = methods = []
+-        _typedInterfaceMetadata[cls, '__properties__'] = properties = []
++        cls.__id__ = nextId()
++        cls.__methods__ = methods = []
++        cls.__properties__ = properties = []
++        cls.default = 'DEFAULT'
++        cls.complexType = True
+         possibleActions = []
+         actionAttachers = []
+         for key, value in dct.items():
+@@ -825,21 +815,21 @@
+             attacher.attachActionBindings(possibleActions)
+         methods.sort(_sorter)
+         properties.sort(_sorter)
+-        _typedInterfaceMetadata[cls, '__spec__'] = spec = methods + properties
++        cls.__spec__ = spec = methods + properties
+         spec.sort(_sorter)
+-        _typedInterfaceMetadata[cls, 'name'] = name
++        cls.name = name
+ 
+         # because attributes "label" and "description" would become Properties,
+         # check for ones with an underscore prefix.
+-        _typedInterfaceMetadata[cls, 'label'] = dct.get('_label', None)
+-        _typedInterfaceMetadata[cls, 'description'] = dct.get('_description', None)
++        cls.label = dct.get('_label', None)
++        cls.description = dct.get('_description', None)
+         defaultLabel, defaultDescription = labelAndDescriptionFromDocstring(dct.get('__doc__'))
+         if defaultLabel is None:
+             defaultLabel = nameToLabel(name)
+-        if _typedInterfaceMetadata[cls, 'label'] is None:
+-            _typedInterfaceMetadata[cls, 'label'] = defaultLabel
+-        if _typedInterfaceMetadata[cls, 'description'] is None:
+-            _typedInterfaceMetadata[cls, 'description'] = defaultDescription
++        if cls.label is None:
++            cls.label = defaultLabel
++        if cls.description is None:
++            cls.description = defaultDescription
+ 
+         return rv
+ 
+

Added: packages/nevow/trunk/debian/patches/2700-unittests-fix.patch
===================================================================
--- packages/nevow/trunk/debian/patches/2700-unittests-fix.patch	                        (rev 0)
+++ packages/nevow/trunk/debian/patches/2700-unittests-fix.patch	2013-11-02 00:19:31 UTC (rev 26354)
@@ -0,0 +1,51 @@
+Author: Jean-Paul Calderone <exarkun at twistedmatrix.com>
+Forwarded: not-needed
+Description: Update two Nevow unit tests to work with more recent versions of Twisted
+  This will introduce a test failure against Twisted < 11.0, but no
+  implementation changes are actually being made, so no actual
+  functionality should be lost on old Twisted versions.
+
+--- Nevow/nevow/test/test_appserver.py	2007-12-20 15:51:48 +0000
++++ Nevow/nevow/test/test_appserver.py	2013-01-01 21:44:51 +0000
+@@ -170,14 +170,20 @@
+         assert proto.transport.disconnecting
+         return proto
+ 
++
++    def setSiteTime(self, when):
++        """
++        Forcibly override the current time as known by C{self.site}.
++
++        This relies on knowledge of private details of
++        L{twisted.web.server.Site}.  It would be nice if there were an API on
++        that class for doing this more properly, to facilitate testing.
++        """
++        self.site._logDateTime = when
++
++
+     def test_oldStyle(self):
+-        # need to try the new location first to make _logDateTime
+-        # faking work
+-        try:
+-            from twisted.web import http
+-        except ImportError:
+-            from twisted.protocols import http
+-        http._logDateTime = 'faketime' # ugly :(
++        self.setSiteTime('faketime')
+         proto = self.renderResource('/foo')
+         logLines = proto.site.logFile.getvalue().splitlines()
+         self.assertEquals(len(logLines), 1)
+
+=== modified file 'Nevow/nevow/test/test_errorhandler.py'
+--- Nevow/nevow/test/test_errorhandler.py	2006-04-14 17:23:46 +0000
++++ Nevow/nevow/test/test_errorhandler.py	2012-12-31 00:27:39 +0000
+@@ -79,7 +79,7 @@
+         def later((code, html)):
+             self.assertEquals(rend.FourOhFour.notFound, html)
+             self.assertEquals(code, 404)
+-            fe = log.flushErrors(BrokenException)
++            fe = self.flushLoggedErrors(BrokenException)
+             self.assertEquals(len(fe), 1)
+         return renderResource('/foo', notFoundHandler=BadNotFoundHandler()).addCallback(later)
+ 
+

Modified: packages/nevow/trunk/debian/patches/series
===================================================================
--- packages/nevow/trunk/debian/patches/series	2013-11-01 23:54:47 UTC (rev 26353)
+++ packages/nevow/trunk/debian/patches/series	2013-11-02 00:19:31 UTC (rev 26354)
@@ -1,2 +1,4 @@
 01-add-doc-from-svn.patch
-02-fix-web-log-test.patch
+2662-deprecation-warnings.patch
+2682-zope-interface-compat.patch
+2700-unittests-fix.patch




More information about the Python-modules-commits mailing list