[Python-modules-commits] [python-websockets] 02/08: Import python-websockets_3.3.orig.tar.gz

Piotr Ożarowski piotr at moszumanska.debian.org
Fri Jun 30 12:54:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

piotr pushed a commit to branch master
in repository python-websockets.

commit 4af41ef37b2c30dd408c21d5d3853059267bbe85
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Fri Jun 30 14:44:53 2017 +0200

    Import python-websockets_3.3.orig.tar.gz
---
 PKG-INFO                                           |  10 ++--
 README => README.rst                               |   0
 setup.cfg                                          |   4 +-
 setup.py                                           |  54 +++++++++------------
 websockets.egg-info/PKG-INFO                       |  10 ++--
 websockets.egg-info/SOURCES.txt                    |   7 ++-
 websockets/http.py                                 |   2 +-
 websockets/protocol.py                             |   9 +++-
 .../py35/__pycache__/__init__.cpython-36.pyc       | Bin 0 -> 146 bytes
 websockets/py35/__pycache__/client.cpython-35.pyc  | Bin 1123 -> 1123 bytes
 websockets/py35/__pycache__/client.cpython-36.pyc  | Bin 0 -> 1081 bytes
 .../py35/__pycache__/client_server.cpython-35.pyc  | Bin 1460 -> 1460 bytes
 .../py35/__pycache__/client_server.cpython-36.pyc  | Bin 0 -> 1373 bytes
 websockets/server.py                               |  11 ++++-
 websockets/test_client_server.py                   |   3 +-
 websockets/test_protocol.py                        |   4 +-
 websockets/version.py                              |   2 +-
 17 files changed, 63 insertions(+), 53 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index f1dce5a..25cb85c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,13 +1,15 @@
 Metadata-Version: 1.1
 Name: websockets
-Version: 3.2
+Version: 3.3
 Summary: An implementation of the WebSocket Protocol (RFC 6455)
 Home-page: https://github.com/aaugustin/websockets
 Author: Aymeric Augustin
 Author-email: aymeric.augustin at m4x.org
 License: BSD
-Download-URL: https://pypi.python.org/pypi/websockets
-Description: ``websockets`` is a library for developing WebSocket servers_ and clients_ in
+Description: WebSockets
+        ==========
+        
+        ``websockets`` is a library for developing WebSocket servers_ and clients_ in
         Python. It implements `RFC 6455`_ with a focus on correctness and simplicity.
         It passes the `Autobahn Testsuite`_.
         
@@ -33,7 +35,7 @@ Description: ``websockets`` is a library for developing WebSocket servers_ and c
         .. _issue: https://github.com/aaugustin/websockets/issues/new
         .. _pull request: https://github.com/aaugustin/websockets/compare/
         
-Platform: all
+Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
 Classifier: Intended Audience :: Developers
diff --git a/README b/README.rst
similarity index 100%
rename from README
rename to README.rst
diff --git a/setup.cfg b/setup.cfg
index db1954c..3a7ef73 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,14 +2,14 @@
 python-tag = py33.py34.py35
 
 [flake8]
-ignore = E731,F403
+ignore = E731,F403,F405
 
 [isort]
 known_standard_library = asyncio
 lines_after_imports = 2
 
 [egg_info]
-tag_date = 0
 tag_build = 
+tag_date = 0
 tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index 06ff24b..57ced17 100644
--- a/setup.py
+++ b/setup.py
@@ -1,25 +1,16 @@
-import os
+import os.path
 import sys
 
 import setuptools
 
-
-# Avoid polluting the .tar.gz with ._* files under Mac OS X
-os.putenv('COPYFILE_DISABLE', 'true')
-
-root = os.path.dirname(__file__)
-
-# Prevent distutils from complaining that a standard file wasn't found
-README = os.path.join(root, 'README')
-if not os.path.exists(README):
-    os.symlink(README + '.rst', README)
+root_dir = os.path.abspath(os.path.dirname(__file__))
 
 description = "An implementation of the WebSocket Protocol (RFC 6455)"
 
-with open(os.path.join(root, 'README'), encoding='utf-8') as f:
-    long_description = '\n\n'.join(f.read().split('\n\n')[1:])
+with open(os.path.join(root_dir, 'README.rst')) as f:
+    long_description = f.read()
 
-with open(os.path.join(root, 'websockets', 'version.py'), encoding='utf-8') as f:
+with open(os.path.join(root_dir, 'websockets', 'version.py')) as f:
     exec(f.read())
 
 py_version = sys.version_info[:2]
@@ -28,34 +19,33 @@ if py_version < (3, 3):
     raise Exception("websockets requires Python >= 3.3.")
 
 packages = ['websockets']
+
 if py_version >= (3, 5):
     packages.append('websockets/py35')
 
 setuptools.setup(
     name='websockets',
     version=version,
-    author='Aymeric Augustin',
-    author_email='aymeric.augustin at m4x.org',
-    url='https://github.com/aaugustin/websockets',
     description=description,
     long_description=long_description,
-    download_url='https://pypi.python.org/pypi/websockets',
+    url='https://github.com/aaugustin/websockets',
+    author='Aymeric Augustin',
+    author_email='aymeric.augustin at m4x.org',
+    license='BSD',
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Environment :: Web Environment',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: BSD License',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
+    ],
     packages=packages,
     extras_require={
         ':python_version=="3.3"': ['asyncio'],
     },
-    classifiers=[
-        "Development Status :: 5 - Production/Stable",
-        "Environment :: Web Environment",
-        "Intended Audience :: Developers",
-        "License :: OSI Approved :: BSD License",
-        "Operating System :: OS Independent",
-        "Programming Language :: Python",
-        "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.3",
-        "Programming Language :: Python :: 3.4",
-        "Programming Language :: Python :: 3.5",
-    ],
-    platforms='all',
-    license='BSD'
 )
diff --git a/websockets.egg-info/PKG-INFO b/websockets.egg-info/PKG-INFO
index f1dce5a..25cb85c 100644
--- a/websockets.egg-info/PKG-INFO
+++ b/websockets.egg-info/PKG-INFO
@@ -1,13 +1,15 @@
 Metadata-Version: 1.1
 Name: websockets
-Version: 3.2
+Version: 3.3
 Summary: An implementation of the WebSocket Protocol (RFC 6455)
 Home-page: https://github.com/aaugustin/websockets
 Author: Aymeric Augustin
 Author-email: aymeric.augustin at m4x.org
 License: BSD
-Download-URL: https://pypi.python.org/pypi/websockets
-Description: ``websockets`` is a library for developing WebSocket servers_ and clients_ in
+Description: WebSockets
+        ==========
+        
+        ``websockets`` is a library for developing WebSocket servers_ and clients_ in
         Python. It implements `RFC 6455`_ with a focus on correctness and simplicity.
         It passes the `Autobahn Testsuite`_.
         
@@ -33,7 +35,7 @@ Description: ``websockets`` is a library for developing WebSocket servers_ and c
         .. _issue: https://github.com/aaugustin/websockets/issues/new
         .. _pull request: https://github.com/aaugustin/websockets/compare/
         
-Platform: all
+Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
 Classifier: Intended Audience :: Developers
diff --git a/websockets.egg-info/SOURCES.txt b/websockets.egg-info/SOURCES.txt
index 6acd883..4bfa088 100644
--- a/websockets.egg-info/SOURCES.txt
+++ b/websockets.egg-info/SOURCES.txt
@@ -1,6 +1,6 @@
 LICENSE
 MANIFEST.in
-README
+README.rst
 setup.cfg
 setup.py
 websockets/__init__.py
@@ -31,5 +31,8 @@ websockets/py35/client_server.py
 websockets/py35/__pycache__/__init__.cpython-33.pyc
 websockets/py35/__pycache__/__init__.cpython-34.pyc
 websockets/py35/__pycache__/__init__.cpython-35.pyc
+websockets/py35/__pycache__/__init__.cpython-36.pyc
 websockets/py35/__pycache__/client.cpython-35.pyc
-websockets/py35/__pycache__/client_server.cpython-35.pyc
\ No newline at end of file
+websockets/py35/__pycache__/client.cpython-36.pyc
+websockets/py35/__pycache__/client_server.cpython-35.pyc
+websockets/py35/__pycache__/client_server.cpython-36.pyc
\ No newline at end of file
diff --git a/websockets/http.py b/websockets/http.py
index 561e798..81f22a8 100644
--- a/websockets/http.py
+++ b/websockets/http.py
@@ -63,7 +63,7 @@ def read_response(stream):
 
     """
     status_line, headers = yield from read_message(stream)
-    version, status, reason = status_line[:-2].decode().split(None, 2)
+    version, status, reason = status_line[:-2].decode().split(" ", 2)
     if version != 'HTTP/1.1':
         raise ValueError("Unsupported HTTP version")
     return int(status), headers
diff --git a/websockets/protocol.py b/websockets/protocol.py
index bfc9cd7..979ad4b 100644
--- a/websockets/protocol.py
+++ b/websockets/protocol.py
@@ -124,6 +124,7 @@ class WebSocketCommonProtocol(asyncio.StreamReaderProtocol):
 
         self.reader = None
         self.writer = None
+        self._drain_lock = asyncio.Lock(loop=loop)
 
         self.request_headers = None
         self.raw_request_headers = None
@@ -562,8 +563,12 @@ class WebSocketCommonProtocol(asyncio.StreamReaderProtocol):
                     yield
 
         try:
-            # Handle flow control automatically.
-            yield from self.writer.drain()
+            # drain() cannot be called concurrently by multiple coroutines:
+            # http://bugs.python.org/issue29930. Remove this lock when no
+            # version of Python where this bugs exists is supported anymore.
+            with (yield from self._drain_lock):
+                # Handle flow control automatically.
+                yield from self.writer.drain()
         except ConnectionError:
             # Terminate the connection if the socket died.
             yield from self.fail_connection(1006)
diff --git a/websockets/py35/__pycache__/__init__.cpython-36.pyc b/websockets/py35/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..2f33d93
Binary files /dev/null and b/websockets/py35/__pycache__/__init__.cpython-36.pyc differ
diff --git a/websockets/py35/__pycache__/client.cpython-35.pyc b/websockets/py35/__pycache__/client.cpython-35.pyc
index 8ee0fe7..71b68ae 100644
Binary files a/websockets/py35/__pycache__/client.cpython-35.pyc and b/websockets/py35/__pycache__/client.cpython-35.pyc differ
diff --git a/websockets/py35/__pycache__/client.cpython-36.pyc b/websockets/py35/__pycache__/client.cpython-36.pyc
new file mode 100644
index 0000000..e704181
Binary files /dev/null and b/websockets/py35/__pycache__/client.cpython-36.pyc differ
diff --git a/websockets/py35/__pycache__/client_server.cpython-35.pyc b/websockets/py35/__pycache__/client_server.cpython-35.pyc
index 6233375..d482282 100644
Binary files a/websockets/py35/__pycache__/client_server.cpython-35.pyc and b/websockets/py35/__pycache__/client_server.cpython-35.pyc differ
diff --git a/websockets/py35/__pycache__/client_server.cpython-36.pyc b/websockets/py35/__pycache__/client_server.cpython-36.pyc
new file mode 100644
index 0000000..15f129d
Binary files /dev/null and b/websockets/py35/__pycache__/client_server.cpython-36.pyc differ
diff --git a/websockets/server.py b/websockets/server.py
index dab1479..dbc3eec 100644
--- a/websockets/server.py
+++ b/websockets/server.py
@@ -62,6 +62,9 @@ class WebSocketServerProtocol(WebSocketCommonProtocol):
                 path = yield from self.handshake(
                     origins=self.origins, subprotocols=self.subprotocols,
                     extra_headers=self.extra_headers)
+            except ConnectionError as exc:
+                logger.info('Connection error during opening handshake', exc_info=True)
+                raise
             except Exception as exc:
                 if self._is_server_shutting_down(exc):
                     response = ('HTTP/1.1 503 Service Unavailable\r\n\r\n'
@@ -89,6 +92,11 @@ class WebSocketServerProtocol(WebSocketCommonProtocol):
 
             try:
                 yield from self.close()
+            except ConnectionError as exc:
+                if self._is_server_shutting_down(exc):
+                    pass
+                logger.info('Connection error in closing handshake', exc_info=True)
+                raise
             except Exception as exc:
                 if self._is_server_shutting_down(exc):
                     pass
@@ -195,7 +203,8 @@ class WebSocketServerProtocol(WebSocketCommonProtocol):
 
         return path
 
-    def select_subprotocol(self, client_protos, server_protos):
+    @staticmethod
+    def select_subprotocol(client_protos, server_protos):
         """
         Pick a subprotocol among those offered by the client.
 
diff --git a/websockets/test_client_server.py b/websockets/test_client_server.py
index 948c631..d634156 100644
--- a/websockets/test_client_server.py
+++ b/websockets/test_client_server.py
@@ -234,8 +234,7 @@ class ClientServerTests(unittest.TestCase):
         self.stop_client()
         self.stop_server()
 
-    @unittest.mock.patch.object(
-        WebSocketServerProtocol, 'select_subprotocol', autospec=True)
+    @unittest.mock.patch.object(WebSocketServerProtocol, 'select_subprotocol')
     def test_subprotocol_error(self, _select_subprotocol):
         _select_subprotocol.return_value = 'superchat'
 
diff --git a/websockets/test_protocol.py b/websockets/test_protocol.py
index 2e256c6..b4ad4d2 100644
--- a/websockets/test_protocol.py
+++ b/websockets/test_protocol.py
@@ -258,7 +258,7 @@ class CommonTests:
         self.run_loop_once()
         # The connection is established.
         self.assertEqual(self.protocol.local_address, ('host', 4312))
-        get_extra_info.assert_called_once_with('sockname', None)
+        get_extra_info.assert_called_with('sockname', None)
 
     def test_remote_address(self):
         get_extra_info = unittest.mock.Mock(return_value=('host', 4312))
@@ -268,7 +268,7 @@ class CommonTests:
         self.run_loop_once()
         # The connection is established.
         self.assertEqual(self.protocol.remote_address, ('host', 4312))
-        get_extra_info.assert_called_once_with('peername', None)
+        get_extra_info.assert_called_with('peername', None)
 
     def test_open(self):
         self.assertTrue(self.protocol.open)
diff --git a/websockets/version.py b/websockets/version.py
index 7970055..680144b 100644
--- a/websockets/version.py
+++ b/websockets/version.py
@@ -1 +1 @@
-version = '3.2'
+version = '3.3'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-websockets.git



More information about the Python-modules-commits mailing list