[Python-modules-commits] r14414 - in packages/pyside/trunk/debian (3 files)

odyx-guest at users.alioth.debian.org odyx-guest at users.alioth.debian.org
Mon Sep 13 15:41:23 UTC 2010


    Date: Monday, September 13, 2010 @ 15:41:22
  Author: odyx-guest
Revision: 14414

  - u_0ba776e_fix_bugs_282_283.patch
    Import from upstream to fix QtNetwork HTTP examples in python 2.5

Added:
  packages/pyside/trunk/debian/patches/u_0ba776e_fix_bugs_282_283.patch
Modified:
  packages/pyside/trunk/debian/changelog
  packages/pyside/trunk/debian/patches/series

Modified: packages/pyside/trunk/debian/changelog
===================================================================
--- packages/pyside/trunk/debian/changelog	2010-09-13 15:38:30 UTC (rev 14413)
+++ packages/pyside/trunk/debian/changelog	2010-09-13 15:41:22 UTC (rev 14414)
@@ -1,3 +1,11 @@
+pyside (0.4.0-3) UNRELEASED; urgency=low
+
+  * Patches:
+    - u_0ba776e_fix_bugs_282_283.patch
+      Import from upstream to fix QtNetwork HTTP examples in python 2.5
+
+ -- Didier Raboud <didier at raboud.com>  Thu, 09 Sep 2010 11:21:53 +0200
+
 pyside (0.4.0-2) experimental; urgency=low
 
   [ Didier Raboud ]

Modified: packages/pyside/trunk/debian/patches/series
===================================================================
--- packages/pyside/trunk/debian/patches/series	2010-09-13 15:38:30 UTC (rev 14413)
+++ packages/pyside/trunk/debian/patches/series	2010-09-13 15:41:22 UTC (rev 14414)
@@ -1,6 +1,7 @@
 u_c130273_fix_py25_QtScript_property.patch
 u_20e226b_fix_missing_qcoreapplication_arguments_method.patch
 u_268bf77_fixed_signal_signature_parser.patch
+u_0ba776e_fix_bugs_282_283.patch
 libPythonVersionPostfix.patch
 usePySpecificShiboken.patch
 lessBuildVerbosity.patch

Added: packages/pyside/trunk/debian/patches/u_0ba776e_fix_bugs_282_283.patch
===================================================================
--- packages/pyside/trunk/debian/patches/u_0ba776e_fix_bugs_282_283.patch	                        (rev 0)
+++ packages/pyside/trunk/debian/patches/u_0ba776e_fix_bugs_282_283.patch	2010-09-13 15:41:22 UTC (rev 14414)
@@ -0,0 +1,126 @@
+From 0ba776e27a8c17727fa883eed29f60bc6c0bb7be Mon Sep 17 00:00:00 2001
+From: Hugo Parente Lima <hugo.pl at gmail.com>
+Date: Wed, 8 Sep 2010 15:08:41 -0300
+Subject: [PATCH] Fix bug#282 and bug#283.
+
+---
+ tests/util/httpd.py |   84 ++++++++++++++++++++++++++++++++++++++++++++++-----
+ 1 files changed, 76 insertions(+), 8 deletions(-)
+
+diff --git a/tests/util/httpd.py b/tests/util/httpd.py
+index 96750f0..4d7dde9 100644
+--- a/tests/util/httpd.py
++++ b/tests/util/httpd.py
+@@ -1,10 +1,11 @@
+ import SocketServer
+ import BaseHTTPServer
++import os
++import sys
++import threading
++import select
+ import random
+ 
+-from threading import Thread
+-
+-
+ class TestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+     DATA = "PySide Server"
+ 
+@@ -42,22 +43,89 @@ class TestSecureHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+             self.send_header("Content-Length", str(len(TestHandler.DATA)))
+             self.end_headers()
+ 
++# Workaround for the missing shutdown method in python2.5
++class CompatTCPServer(SocketServer.TCPServer):
++    def __init__(self, server_address, RequestHandlerClass):
++        SocketServer.TCPServer.__init__(self, server_address, RequestHandlerClass)
++
++        self.isPy25 = sys.version_info[0] == 2 and sys.version_info[1] == 5
++        if self.isPy25:
++            self.__is_shut_down = threading.Event()
++            self.__serving = False
++
++    def serve_forever(self, poll_interval=0.5):
++        """Handle one request at a time until shutdown.
++
++        Polls for shutdown every poll_interval seconds. Ignores
++        self.timeout. If you need to do periodic tasks, do them in
++        another thread.
++        """
++        if self.isPy25:
++            self.__serving = True
++            self.__is_shut_down.clear()
++            while self.__serving:
++                # XXX: Consider using another file descriptor or
++                # connecting to the socket to wake this up instead of
++                # polling. Polling reduces our responsiveness to a
++                # shutdown request and wastes cpu at all other times.
++                r, w, e = select.select([self], [], [], poll_interval)
++                if r:
++                    self.py25_handle_request_noblock()
++            self.__is_shut_down.set()
++        else:
++            SocketServer.TCPServer.serve_forever(self, poll_interval)
++
++    def py25_handle_request_noblock(self):
++        """Handle one request, without blocking.
++
++        I assume that select.select has returned that the socket is
++        readable before this function was called, so there should be
++        no risk of blocking in get_request().
++        """
++        if self.isPy25:
++            try:
++                request, client_address = self.get_request()
++            except socket.error:
++                return
++            if self.verify_request(request, client_address):
++                try:
++                    self.process_request(request, client_address)
++                except:
++                    self.handle_error(request, client_address)
++                    self.close_request(request)
+ 
+-class TestServer(Thread):
++    def shutdown(self):
++        """Stops the serve_forever loop.
++
++        Blocks until the loop has finished. This must be called while
++        serve_forever() is running in another thread, or it will
++        deadlock.
++        """
++        if self.isPy25:
++            self.__serving = False
++            if not self.__is_shut_down:
++                self.__is_shut_down.wait()
++        else:
++            SocketServer.TCPServer.shutdown(self)
++
++
++class TestServer(threading.Thread):
+ 
+     def __init__(self, secure=False):
+-        Thread.__init__(self)
++        threading.Thread.__init__(self)
+ 
+-        self._port = 8000 + random.randint(0, 100)
++        self._port = int(os.getenv("PYSIDE_TESTSERVER_PORT") or 12321)
+         self.keep_running = True
+-        server = SocketServer.TCPServer
+ 
+         if secure:
+             handle = TestSecureHandler
+         else:
+             handle = TestHandler
+ 
+-        self.httpd = SocketServer.TCPServer((''  , self._port), handle)
++        try:
++            self.httpd = CompatTCPServer((''  , self._port), handle)
++        except:
++            self.httpd = CompatTCPServer((''  , self._port + random.randint(1, 100)), handle)
+ 
+     def port(self):
+         return self._port
+-- 
+1.6.1
+




More information about the Python-modules-commits mailing list