Commits

Anonymous committed 51958d1

Added changelog and refactored exceptions into their own module. Bumped version.

Comments (0)

Files changed (8)

+News: stompclient
+=================
+
+.. contents::
+
+0.3
+---
+
+* Added a changelog ;)
+* Moved exceptions into new stompclient.exceptions module.
 """
 stompclient is a STOMP message client written in Python.
+"""
+import os.path
+import re
+import warnings
 
-stompclient supports bot simplex (publisher-only) and duplex (publish-subscribe)
+from setuptools import setup, find_packages
+
+__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
+__copyright__ = "Copyright 2010 Hans Lellelid"
+
+version = '0.3'
+
+news = os.path.join(os.path.dirname(__file__), 'docs', 'news.txt')
+news = open(news).read()
+parts = re.split(r'([0-9\.]+)\s*\n\r?-+\n\r?', news)
+found_news = ''
+for i in range(len(parts)-1):
+    if parts[i] == version:
+        found_news = parts[i+i]
+        break
+if not found_news:
+    warnings.warn('No news for this version found.')
+
+long_description="""
+stompclient supports both simplex (publisher-only) and duplex (publish-subscribe)
 communication with STOMP servers. This project started as a fork of the stompy
 project by Benjamin W. Smith U{https://bitbucket.org/asksol/python-stomp} but 
 has evolved into a very distinct codebase, which combines a few  aspects of 
 stompy with features from Stomper and CoilMQ.
 """
-from setuptools import setup, find_packages
 
-__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
-__copyright__ = "Copyright 2010 Hans Lellelid"
-
+if found_news:
+    title = 'Changes in %s' % version
+    long_description += "\n%s\n%s\n" % (title, '-'*len(title))
+    long_description += found_news
+    
 setup(name='stompclient',
-      version="0.2.2",
+      version="0.3",
       description=__doc__,
       author="Hans Lellelid",
       author_email="hans@xmpl.org",
       keywords='stomp client',
       test_suite="nose.collector",
       setup_requires=['nose>=0.11', 'mock'],
-      classifiers=["Development Status :: 2 - Pre-Alpha",
+      classifiers=["Development Status :: 3 - Alpha",
                    "Intended Audience :: Developers",
                    "License :: OSI Approved :: Apache Software License",
                    "Operating System :: OS Independent",

stompclient/connection.py

 import threading
 
 from stompclient.util import FrameBuffer
+from stompclient.exceptions import ConnectionError, ConnectionTimeoutError, NotConnectedError
 
 __authors__ = ['"Hans Lellelid" <hans@xmpl.org>', 'Andy McCurdy (redis)']
 __copyright__ = "Copyright 2010 Hans Lellelid, Copyright 2010 Andy McCurdy"
 See the License for the specific language governing permissions and
 limitations under the License."""
 
-class NotConnectedError(Exception):
-    """No longer connected to the STOMP server."""
-
-
-class ConnectionError(socket.error):
-    """Couldn't connect to the STOMP server."""
-
-
-class ConnectionTimeoutError(socket.timeout):
-    """Timed-out while establishing connection to the STOMP server."""
-
-
 class ConnectionPool(object):
     """
     A global pool of connections keyed by host:port.

stompclient/duplex.py

 
 from stompclient import frame
 from stompclient.simplex import BaseClient
-from stompclient.connection import ConnectionError, NotConnectedError
+from stompclient.exceptions import NotConnectedError
 
 __authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
 __copyright__ = "Copyright 2010 Hans Lellelid"

stompclient/exceptions.py

+"""
+Exception classes used by the stompclient library.
+"""
+
+import socket
+
+__authors__ = ['"Hans Lellelid" <hans@xmpl.org>']
+__copyright__ = "Copyright 2010 Hans Lellelid"
+__license__ = """Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License."""
+
+class NotConnectedError(Exception):
+    """No longer connected to the STOMP server."""
+
+class ConnectionError(socket.error):
+    """Couldn't connect to the STOMP server."""
+
+class ConnectionTimeoutError(socket.timeout):
+    """Timed-out while establishing connection to the STOMP server."""
+
+class FrameError(Exception):
+    """
+    Raise for problem with frame generation or parsing.
+    """

stompclient/frame.py

 """
 import uuid
 
+from stompclient.exceptions import FrameError
+ 
 __authors__ = ['"Hans Lellelid" <hans@xmpl.org>', 'Ricky Iacovou (stomper)', 'Benjamin W. Smith (stompy)']
 __copyright__ = "Copyright 2010 Hans Lellelid, Copyright 2008 Ricky Iacovou, Copyright 2009 Benjamin W. Smith"
 __license__ = """Licensed under the Apache License, Version 2.0 (the "License");
     'RECEIPT', 'ERROR',    
 ]
 
-class FrameError(Exception):
-    """
-    Raise for problem with frame generation or parsing.
-    """
-
 class Frame(object):
     """
     Class to hold a STOMP message frame. 

stompclient/simplex.py

 import logging
 
 from stompclient import frame
-from stompclient.connection import ConnectionPool, ThreadLocalConnectionPool, ConnectionError, NotConnectedError
+from stompclient.connection import ConnectionPool, ThreadLocalConnectionPool
+from stompclient.exceptions import ConnectionError, NotConnectedError
 
 __authors__ = ['"Hans Lellelid" <hans@xmpl.org>', 'Benjamin W. Smith (stompy)']
 __copyright__ = "Copyright 2010 Hans Lellelid, Copyright 2008 Ricky Iacovou, Copyright 2009 Benjamin W. Smith"

stompclient/tests/test_connection.py

 import mock
 
 import stompclient.connection
-from stompclient.connection import (ThreadLocalConnectionPool, ConnectionPool, Connection, 
-                                    ConnectionError, ConnectionTimeoutError, NotConnectedError)
+from stompclient.connection import ThreadLocalConnectionPool, ConnectionPool, Connection
+from stompclient.exceptions import ConnectionError, ConnectionTimeoutError, NotConnectedError
 from stompclient import frame
 
 from stompclient.tests.mockutil import MockingSocketModule