Hello community, here is the log from the commit of package python-stomper for openSUSE:Factory checked in at 2013-11-18 10:53:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-stomper (Old) and /work/SRC/openSUSE:Factory/.python-stomper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-stomper" Changes: -------- --- /work/SRC/openSUSE:Factory/python-stomper/python-stomper.changes 2013-10-25 11:33:10.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-stomper.new/python-stomper.changes 2013-11-18 10:53:53.000000000 +0100 @@ -1,0 +2,13 @@ +Sun Nov 17 18:50:51 UTC 2013 - p.drou...@gmail.com + +- Update to version 0.2.7 + + add a MANIFEST.in which makes sure README.md is present. Without + this pip install fails: https://github.com/oisinmulvihill/stomper/issues/3. +- Changes from version 0.2.6 + + correct many spelling mistakes throughout the code base. + + make the README.md the main +- Changes from 0.2.5 + + removes the extra line ending which can cause problems. +- README has been renamed in README.md; change it in %doc + +------------------------------------------------------------------- Old: ---- stomper-0.2.4.tar.gz New: ---- stomper-0.2.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-stomper.spec ++++++ --- /var/tmp/diff_new_pack.mM1K3e/_old 2013-11-18 10:53:54.000000000 +0100 +++ /var/tmp/diff_new_pack.mM1K3e/_new 2013-11-18 10:53:54.000000000 +0100 @@ -17,7 +17,7 @@ Name: python-stomper -Version: 0.2.4 +Version: 0.2.7 Release: 0 Summary: This is a transport neutral client implementation of the STOMP protocol License: Apache-2.0 @@ -56,7 +56,7 @@ %files %defattr(-,root,root,-) -%doc README lib/stomper/examples +%doc README.md lib/stomper/examples %{python_sitelib}/* %changelog ++++++ stomper-0.2.4.tar.gz -> stomper-0.2.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/MANIFEST.in new/stomper-0.2.7/MANIFEST.in --- old/stomper-0.2.4/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/stomper-0.2.7/MANIFEST.in 2013-06-17 15:14:23.000000000 +0200 @@ -0,0 +1 @@ +include README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/PKG-INFO new/stomper-0.2.7/PKG-INFO --- old/stomper-0.2.4/PKG-INFO 2010-09-28 18:23:28.000000000 +0200 +++ new/stomper-0.2.7/PKG-INFO 2013-06-17 15:34:24.000000000 +0200 @@ -1,8 +1,8 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: stomper -Version: 0.2.4 +Version: 0.2.7 Summary: This is a transport neutral client implementation of the STOMP protocol. -Home-page: http://code.google.com/p/stomper +Home-page: https://github.com/oisinmulvihill/stomper Author: Oisin Mulvihill Author-email: oisin dot mulvihill at gmail com License: http://www.apache.org/licenses/LICENSE-2.0 @@ -10,14 +10,18 @@ Stomper ======= - .. content: + .. contents:: :Author: - Oisin Mulvihill + Oisin Mulvihill Contributors: - Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, - Arfrever Frehtes Taifersar Arahesis <arfrever dot fta at gmail dot com> + Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, + Arfrever Frehtes <arfrever dot fta at gmail dot com>, + Niki Pore <niki pore at gmail dot com>, + Simon Chopin, + Arfrever <https://github.com/Arfrever>, + Ian Weller <https://github.com/ianweller>, Introduction @@ -26,7 +30,7 @@ This is a python client implementation of the STOMP protocol. The client is attempting to be transport layer neutral. This module provides - functions to create and parse STOMP messages in a programatic fashion. The + functions to create and parse STOMP messages in a programmatic fashion. The messages can be easily generated and parsed, however its up to the user to do the sending and receiving. The STOMP protocol specification can be found here: @@ -34,7 +38,7 @@ I've looked at the stomp client by Jason R. Briggs. I've based some of the 'function to message' generation on how his client does it. The client can - be found at the follow address however it isn't a dependancy. + be found at the follow address however it isn't a dependency. - `stompy <http://www.briggs.net.nz/log/projects/stomppy>`_ @@ -79,10 +83,32 @@ Version History --------------- + 0.2.7 + ~~~~~ + + I forgot to add a MANIFEST.in which makes sure README.md is present. Without + this pip install fails: https://github.com/oisinmulvihill/stomper/issues/3. + Thanks to Ian Weller for noticing this. I've also added in the fix suggested + by Arfrever https://github.com/oisinmulvihill/stomper/issues/1. + + + 0.2.6 + ~~~~~ + + Add contributed fixes from Simon Chopin. He corrected many spelling mistakes + throughout the code base. I've also made the README.md the main + + 0.2.5 + ~~~~~ + + Add the contributed fix for issue #14 by Niki Pore. The issue was reported by + Roger Hoover. This removes the extra line ending which can cause problems. + + 0.2.4 ~~~~~ - OM: A minor relase fixing the problem whereby uuid would be installed on python2.5+. It + OM: A minor release fixing the problem whereby uuid would be installed on python2.5+. It is not needed after python2.4 as it comes with python. Arfrever Frehtes Taifersar Arahesis contributed the fix for this. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/README new/stomper-0.2.7/README --- old/stomper-0.2.4/README 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/README 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -see stomper.doc/stomper.stx \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/README.md new/stomper-0.2.7/README.md --- old/stomper-0.2.4/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/stomper-0.2.7/README.md 2013-06-17 15:30:44.000000000 +0200 @@ -0,0 +1,177 @@ +======= +Stomper +======= + +.. contents:: + +:Author: + Oisin Mulvihill + +Contributors: + Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, + Arfrever Frehtes <arfrever dot fta at gmail dot com>, + Niki Pore <niki pore at gmail dot com>, + Simon Chopin, + Arfrever <https://github.com/Arfrever>, + Ian Weller <https://github.com/ianweller>, + + +Introduction +------------ + +This is a python client implementation of the STOMP protocol. + +The client is attempting to be transport layer neutral. This module provides +functions to create and parse STOMP messages in a programmatic fashion. The +messages can be easily generated and parsed, however its up to the user to do +the sending and receiving. The STOMP protocol specification can be found here: + +- `Stomp Protocol <http://stomp.codehaus.org/Protocol/>`_ + +I've looked at the stomp client by Jason R. Briggs. I've based some of the +'function to message' generation on how his client does it. The client can +be found at the follow address however it isn't a dependency. + +- `stompy <http://www.briggs.net.nz/log/projects/stomppy>`_ + +In testing this library I run against ActiveMQ project. The server runs +in java, however its fairly standalone and easy to set up. The projects +page is here: + +- `ActiveMQ <http://activemq.apache.org/>`_ + + +Source Code +----------- + +The code can be accessed via subversion via google project hosting. Further +details can be found here: + +- `Stomper http://code.google.com/p/stomper/`_ + + +Examples +-------- + +Basic Usage +~~~~~~~~~~~ + +To see some basic code usage example see "*example/stomper_usage.py*". The unit test +"*tests/teststomper.py*" illustrates how to use all aspects of the code. + + +Receive/Sender +~~~~~~~~~~~~~~ + +The example "*receiver.py*" and "*sender.py*" show how messages and generated and then +transmitted using the twisted framework. Other frameworks could be used instead. The +examples also demonstrate the state machine I used to determine a response to received +messages. + +I've also included "*stompbuffer-rx.py*" and "*stompbuffer-tx.py*" as examples of using +the new stompbuffer module contributed by Ricky Iacovou. + + +Version History +--------------- + +0.2.7 +~~~~~ + +I forgot to add a MANIFEST.in which makes sure README.md is present. Without +this pip install fails: https://github.com/oisinmulvihill/stomper/issues/3. +Thanks to Ian Weller for noticing this. I've also added in the fix suggested +by Arfrever https://github.com/oisinmulvihill/stomper/issues/1. + + +0.2.6 +~~~~~ + +Add contributed fixes from Simon Chopin. He corrected many spelling mistakes +throughout the code base. I've also made the README.md the main + +0.2.5 +~~~~~ + +Add the contributed fix for issue #14 by Niki Pore. The issue was reported by +Roger Hoover. This removes the extra line ending which can cause problems. + + +0.2.4 +~~~~~ + +OM: A minor release fixing the problem whereby uuid would be installed on python2.5+. It +is not needed after python2.4 as it comes with python. Arfrever Frehtes Taifersar Arahesis +contributed the fix for this. + + +0.2.3 +~~~~~ + +OM: I've fixed issue #9 with the example code. All messages are sent and received correctly. + + +0.2.2 +~~~~~ + +- Applied patch from esteve.fernandez to resolve "Issue 4: First Message not received" in the +example code (http://code.google.com/p/stomper/issues/detail?id=4&can=1). + +- I've (Oisin) updated the examples to use twisted's line receiver and got it to "detect" +complete stomp messages. The old example would not work if a large amount of data was streamed. +In this case dataReceived would be called with all the chunks of a message. This means that it +would not be correct for it to attempt to unpack and react until the whole message has been +received. Using twisted's line receiver looking for the \x00 works like a charm for this. + + +This release integrates the bug fixes and the optional stompbuffer contributed by Ricky +Iacovou: + +- Removed the trailing '\n\n' inserted by Frame.pack(). I believe that adding this is +incorrect, for the following reasons: + +http://stomp.codehaus.org/Protocol gives the example: + +CONNECT +login: <username> +passcode:<passcode> + +^@ + +and comments, "the body is empty in this case". This gives the impression that the body +is *exactly* defined as "the bytes, if any, between the '\n\n' at the end of the header +and the null byte". + +This works for both binary and ASCII payloads: if I want to send a string without a +newline, I should be able to, in which case the body should look like: + +this is a string without a newline^@ + +... and the receiver should deal with this. + +This impression is reinforced by the fact that ActiveMQ will complain if you supply a +content-length header with any other byte count than that described above. + +I am also unsure about the newline after the null byte as nothing in the protocol says +that there should be a newline after the null byte. Much of the code in StompBuffer +actively expects it to be there, but I suspect that *relying* on a frame ending '\x00\n' +may well limit compatibility. It's not an issue with Stomper-to-Stomper communication, +of course, as the sender puts it, the receiver accepts it, and ActiveMQ happily sends +it along. + +- StompBuffer has had a few fixes; most notably, a fix that prevents a content-length "header" +in the *body* from being picked up and used (!). The biggest change is a new method, +syncBuffer(), which allows a corrupted buffer to recover from the corruption. Note that +I've never actually *seen* the buffer corruption when using Twisted, but the thought +occurred to me that a single corrupt buffer could hang the entire message handling process. + +- Fixed the typo "NO_REPONSE_NEEDED". I've changed it to NO_RESPONSE_NEEDED, but kept the +old variable for backwards compatibility; + +- I've also modified the string format in send() to include the '\n\n' between the header +and the body, which I think is missing (it currently has only one '\n'). + +- Added CONNECTED to VALID_COMMANDS so syncBuffer() does not decide these messages are bogus. + +- Added new unit test file teststompbuffer which covers the new functionality. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/__init__.py new/stomper-0.2.7/lib/stomper/__init__.py --- old/stomper-0.2.4/lib/stomper/__init__.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/__init__.py 2013-06-17 15:23:33.000000000 +0200 @@ -1,10 +1,10 @@ """ -This is a python client implementation of the STOMP protocol. +This is a python client implementation of the STOMP protocol. -It aims to be transport layer neutral. This module provides functions to -create and parse STOMP messages in a programatic fashion. +It aims to be transport layer neutral. This module provides functions to +create and parse STOMP messages in a programmatic fashion. -The examples package contains two examples using twisted as the transport +The examples package contains two examples using twisted as the transport framework. Other frameworks can be used and I may add other examples as time goes on. @@ -13,7 +13,7 @@ * http://stomp.codehaus.org/Protocol I've looked at the stomp client by Jason R. Briggs and have based the message -generation on how his client does it. The client can be found at the follow +generation on how his client does it. The client can be found at the follow address however it isn't a dependancy. * http://www.briggs.net.nz/log/projects/stomppy @@ -35,11 +35,10 @@ import logging -import doc import utils import stompbuffer -# This is used as a return from message reponses functions. +# This is used as a return from message responses functions. # It is used more for readability more then anything or reason. NO_RESPONSE_NEEDED = '' @@ -55,16 +54,16 @@ # STOMP Spec v1.0 valid commands: VALID_COMMANDS = [ - 'ABORT', 'ACK', 'BEGIN', 'COMMIT', + 'ABORT', 'ACK', 'BEGIN', 'COMMIT', 'CONNECT', 'CONNECTED', 'DISCONNECT', 'MESSAGE', 'SEND', 'SUBSCRIBE', 'UNSUBSCRIBE', - 'RECEIPT', 'ERROR', + 'RECEIPT', 'ERROR', ] def get_log(): return logging.getLogger("stomper") - + class FrameError(Exception): """Raise for problem with frame generation or parsing. @@ -72,44 +71,44 @@ class Frame(object): - """This class is used to create or read STOMP message frames. - + """This class is used to create or read STOMP message frames. + The method pack() is used to create a STOMP message ready for transmission. - - The method unpack() is used to read a STOMP message into + + The method unpack() is used to read a STOMP message into a frame instance. It uses the unpack_frame(...) function - to do the intial parsing. + to do the initial parsing. The frame has three important member variables: - + * cmd * headers * body - - The 'cmd' is a property that represents the STOMP message + + The 'cmd' is a property that represents the STOMP message command. When you assign this a check is done to make sure its one of the VALID_COMMANDS. If not then FrameError will be raised. - - The 'headers' is a dictionary which the user can added to - if needed. There are no restrictions or checks imposed on + + The 'headers' is a dictionary which the user can added to + if needed. There are no restrictions or checks imposed on what values are inserted. - - The 'body' is just a member variable that the body text - is assigned to. - - """ + + The 'body' is just a member variable that the body text + is assigned to. + + """ def __init__(self): """Setup the internal state.""" self._cmd = '' self.body = '' self.headers = {} - + def getCmd(self): """Don't use _cmd directly!""" return self._cmd - + def setCmd(self, cmd): """Check the cmd is valid, FrameError will be raised if its not.""" cmd = cmd.upper() @@ -119,46 +118,45 @@ ) else: self._cmd = cmd - + cmd = property(getCmd, setCmd) - def pack(self): """Called to create a STOMP message from the internal values. """ - headers = ['%s:%s'%(f,v) for f,v in self.headers.items()] - headers = "\n".join(headers) - - stomp_mesage = "%s\n%s\n\n%s%s\n" % (self._cmd, headers, self.body, NULL) + headers = ''.join( + ['%s:%s\n' % (f, v) for f, v in sorted(self.headers.items())] + ) + stomp_message = "%s\n%s\n%s%s\n" % (self._cmd, headers, self.body, NULL) # import pprint -# print "stomp_mesage: ", pprint.pprint(stomp_mesage) - - return stomp_mesage +# print "stomp_message: ", pprint.pprint(stomp_message) + + return stomp_message + - def unpack(self, message): """Called to extract a STOMP message into this instance. - + message: - This is a text string representing a valid + This is a text string representing a valid STOMP (v1.0) message. - - This method uses unpack_frame(...) to extract the + + This method uses unpack_frame(...) to extract the information, before it is assigned internally. retuned: The result of the unpack_frame(...) call. - + """ if not message: raise FrameError("Unpack error! The given message isn't valid '%s'!" % message) - + msg = unpack_frame(message) - + self.cmd = msg['cmd'] self.headers = msg['headers'] - + # Assign directly as the message will have the null # character in the message already. self.body = msg['body'] @@ -168,11 +166,11 @@ def unpack_frame(message): """Called to unpack a STOMP message into a dictionary. - + returned = { # STOMP Command: 'cmd' : '...', - + # Headers e.g. 'headers' : { 'destination' : 'xyz', @@ -180,15 +178,15 @@ : etc, } - + # Body: 'body' : '...1234...\x00', } - + """ body = [] returned = dict(cmd='', headers={}, body='') - + breakdown = message.split('\n') # Get the message command: @@ -202,7 +200,7 @@ if index: header = field[:index].strip() data = field[index+1:].strip() -# print "header '%s' data '%s'" % (header, data) +# print "header '%s' data '%s'" % (header, data) returned['headers'][header.strip()] = data.strip() def bodyD(field): @@ -227,55 +225,55 @@ returned['body'] = body.replace('\x00', '') # print "2. body: <%s>" % returned['body'] - + return returned - + def abort(transactionid): """STOMP abort transaction command. Rollback whatever actions in this transaction. - + transactionid: This is the id that all actions in this transaction. - + """ return "ABORT\ntransaction: %s\n\n\x00\n" % transactionid def ack(messageid, transactionid=None): """STOMP acknowledge command. - + Acknowledge receipt of a specific message from the server. messageid: This is the id of the message we are acknowledging, what else could it be? ;) - + transactionid: - This is the id that all actions in this transaction + This is the id that all actions in this transaction will have. If this is not given then a random UUID will be generated for this. - + """ header = 'message-id: %s' % messageid if transactionid: header = 'message-id: %s\ntransaction: %s' % (messageid, transactionid) - + return "ACK\n%s\n\n\x00\n" % header - + def begin(transactionid=None): """STOMP begin command. Start a transaction... - + transactionid: - This is the id that all actions in this transaction + This is the id that all actions in this transaction will have. If this is not given then a random UUID will be generated for this. - + """ if not transactionid: # Generate a random UUID: @@ -283,109 +281,109 @@ return "BEGIN\ntransaction: %s\n\n\x00\n" % transactionid - + def commit(transactionid): """STOMP commit command. Do whatever is required to make the series of actions - permenant for this transactionid. - + permanent for this transactionid. + transactionid: This is the id that all actions in this transaction. - + """ return "COMMIT\ntransaction: %s\n\n\x00\n" % transactionid def connect(username, password): """STOMP connect command. - + username, password: - These are the needed auth details to connect to the + These are the needed auth details to connect to the message server. - + After sending this we will receive a CONNECTED message which will contain our session id. - + """ return "CONNECT\nlogin:%s\npasscode:%s\n\n\x00\n" % (username, password) def disconnect(): """STOMP disconnect command. - + Tell the server we finished and we'll be closing the socket soon. - + """ return "DISCONNECT\n\n\x00\n" - + def send(dest, msg, transactionid=None): """STOMP send command. - + dest: This is the channel we wish to subscribe to - + msg: This is the message body to be sent. - + transactionid: This is an optional field and is not needed by default. - + """ transheader = '' - + if transactionid: transheader = 'transaction: %s' % transactionid - + return "SEND\ndestination: %s\n%s\n\n%s\x00\n" % (dest, transheader, msg) - - + + def subscribe(dest, ack='auto'): """STOMP subscribe command. - + dest: This is the channel we wish to subscribe to - + ack: 'auto' | 'client' If the ack is set to client, then messages received will have to have an acknowledge as a reply. Otherwise the server will assume delivery failure. - + """ return "SUBSCRIBE\ndestination: %s\nack: %s\n\n\x00\n" % (dest, ack) def unsubscribe(dest): """STOMP unsubscribe command. - + dest: This is the channel we wish to subscribe to - + Tell the server we no longer wish to receive any further messages for the given subscription. - + """ return "UNSUBSCRIBE\ndestination:%s\n\n\x00\n" % dest - + class Engine(object): - """This is a simple state machine to return a response to received + """This is a simple state machine to return a response to received message if needed. - + """ def __init__(self, testing=False): self.testing = testing - + self.log = logging.getLogger("stomper.Engine") - + self.sessionId = '' - + # Entry Format: # - # COMMAND : Handler_Function + # COMMAND : Handler_Function # self.states = { 'CONNECTED' : self.connected, @@ -393,11 +391,11 @@ 'ERROR' : self.error, 'RECEIPT' : self.receipt, } - - + + def react(self, msg): """Called to provide a response to a message if needed. - + msg: This is a dictionary as returned by unpack_frame(...) or it can be a straight STOMP message. This function @@ -405,106 +403,106 @@ returned: A message to return or an empty string. - + """ returned = "" - # If its not a string assume its a dict. + # If its not a string assume its a dict. mtype = type(msg) if mtype in types.StringTypes: - msg = unpack_frame(msg) + msg = unpack_frame(msg) elif mtype == types.DictType: pass else: raise FrameError("Unknown message type '%s', I don't know what to do with this!" % mtype) - + if self.states.has_key(msg['cmd']): # print("reacting to message - %s" % msg['cmd']) returned = self.states[msg['cmd']](msg) - + return returned - - + + def connected(self, msg): - """No reponse is needed to a connected frame. - - This method stores the session id as a the + """No response is needed to a connected frame. + + This method stores the session id as the member sessionId for later use. - + returned: NO_RESPONSE_NEEDED - + """ self.sessionId = msg['headers']['session'] #print "connected: session id '%s'." % self.sessionId - + return NO_RESPONSE_NEEDED def ack(self, msg): """Called when a MESSAGE has been received. - + Override this method to handle received messages. - - This function will generate an acknowlege message + + This function will generate an acknowledge message for the given message and transaction (if present). - + """ message_id = msg['headers']['message-id'] transaction_id = None if msg['headers'].has_key('transaction-id'): transaction_id = msg['headers']['transaction-id'] - + # print "acknowledging message id <%s>." % message_id - + return ack(message_id, transaction_id) def error(self, msg): """Called to handle an error message received from the server. - + This method just logs the error message - + returned: NO_RESPONSE_NEEDED - + """ body = msg['body'].replace(NULL, '') - + brief_msg = "" if msg['headers'].has_key('message'): brief_msg = msg['headers']['message'] - + self.log.error("Received server error - message%s\n\n%s" % (brief_msg, body)) - + returned = NO_RESPONSE_NEEDED if self.testing: returned = 'error' - + return returned def receipt(self, msg): """Called to handle a receipt message received from the server. - + This method just logs the receipt message - + returned: NO_RESPONSE_NEEDED - + """ body = msg['body'].replace(NULL, '') - + brief_msg = "" if msg['headers'].has_key('receipt-id'): brief_msg = msg['headers']['receipt-id'] - + self.log.info("Received server receipt message - receipt-id:%s\n\n%s" % (brief_msg, body)) - + returned = NO_RESPONSE_NEEDED if self.testing: returned = 'receipt' - + return returned diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/doc/__init__.py new/stomper-0.2.7/lib/stomper/doc/__init__.py --- old/stomper-0.2.4/lib/stomper/doc/__init__.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/doc/__init__.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -""" -This is used in the setup.py to read in the docs and assign it to -the description in the setup.py. - -(c) Oisin Mulvihill, 2007-07-28. -License: http://www.apache.org/licenses/LICENSE-2.0 - -""" -import os - -doc_dir = os.path.dirname(__file__) - -documentation = os.path.join(doc_dir, "stomper.stx") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/doc/stomper.stx new/stomper-0.2.7/lib/stomper/doc/stomper.stx --- old/stomper-0.2.4/lib/stomper/doc/stomper.stx 2010-09-28 18:14:12.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/doc/stomper.stx 1970-01-01 01:00:00.000000000 +0100 @@ -1,151 +0,0 @@ -======= -Stomper -======= - -.. content: - -:Author: - Oisin Mulvihill - -Contributors: - Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, - Arfrever Frehtes Taifersar Arahesis <arfrever dot fta at gmail dot com> - - -Introduction ------------- - -This is a python client implementation of the STOMP protocol. - -The client is attempting to be transport layer neutral. This module provides -functions to create and parse STOMP messages in a programatic fashion. The -messages can be easily generated and parsed, however its up to the user to do -the sending and receiving. The STOMP protocol specification can be found here: - -- `Stomp Protocol <http://stomp.codehaus.org/Protocol/>`_ - -I've looked at the stomp client by Jason R. Briggs. I've based some of the -'function to message' generation on how his client does it. The client can -be found at the follow address however it isn't a dependancy. - -- `stompy <http://www.briggs.net.nz/log/projects/stomppy>`_ - -In testing this library I run against ActiveMQ project. The server runs -in java, however its fairly standalone and easy to set up. The projects -page is here: - -- `ActiveMQ <http://activemq.apache.org/>`_ - - -Source Code ------------ - -The code can be accessed via subversion via google project hosting. Further -details can be found here: - -- `Stomper http://code.google.com/p/stomper/`_ - - -Examples --------- - -Basic Usage -~~~~~~~~~~~ - -To see some basic code usage example see "*example/stomper_usage.py*". The unit test -"*tests/teststomper.py*" illustrates how to use all aspects of the code. - - -Receive/Sender -~~~~~~~~~~~~~~ - -The example "*receiver.py*" and "*sender.py*" show how messages and generated and then -transmitted using the twisted framework. Other frameworks could be used instead. The -examples also demonstrate the state machine I used to determine a response to received -messages. - -I've also included "*stompbuffer-rx.py*" and "*stompbuffer-tx.py*" as examples of using -the new stompbuffer module contributed by Ricky Iacovou. - - -Version History ---------------- - -0.2.4 -~~~~~ - -OM: A minor relase fixing the problem whereby uuid would be installed on python2.5+. It -is not needed after python2.4 as it comes with python. Arfrever Frehtes Taifersar Arahesis -contributed the fix for this. - - -0.2.3 -~~~~~ - -OM: I've fixed issue #9 with the example code. All messages are sent and received correctly. - - -0.2.2 -~~~~~ - -- Applied patch from esteve.fernandez to resolve "Issue 4: First Message not received" in the -example code (http://code.google.com/p/stomper/issues/detail?id=4&can=1). - -- I've (Oisin) updated the examples to use twisted's line receiver and got it to "detect" -complete stomp messages. The old example would not work if a large amount of data was streamed. -In this case dataReceived would be called with all the chunks of a message. This means that it -would not be correct for it to attempt to unpack and react until the whole message has been -received. Using twisted's line receiver looking for the \x00 works like a charm for this. - - -This release integrates the bug fixes and the optional stompbuffer contributed by Ricky -Iacovou: - -- Removed the trailing '\n\n' inserted by Frame.pack(). I believe that adding this is -incorrect, for the following reasons: - -http://stomp.codehaus.org/Protocol gives the example: - -CONNECT -login: <username> -passcode:<passcode> - -^@ - -and comments, "the body is empty in this case". This gives the impression that the body -is *exactly* defined as "the bytes, if any, between the '\n\n' at the end of the header -and the null byte". - -This works for both binary and ASCII payloads: if I want to send a string without a -newline, I should be able to, in which case the body should look like: - -this is a string without a newline^@ - -... and the receiver should deal with this. - -This impression is reinforced by the fact that ActiveMQ will complain if you supply a -content-length header with any other byte count than that described above. - -I am also unsure about the newline after the null byte as nothing in the protocol says -that there should be a newline after the null byte. Much of the code in StompBuffer -actively expects it to be there, but I suspect that *relying* on a frame ending '\x00\n' -may well limit compatibility. It's not an issue with Stomper-to-Stomper communication, -of course, as the sender puts it, the receiver accepts it, and ActiveMQ happily sends -it along. - -- StompBuffer has had a few fixes; most notably, a fix that prevents a content-length "header" -in the *body* from being picked up and used (!). The biggest change is a new method, -syncBuffer(), which allows a corrupted buffer to recover from the corruption. Note that -I've never actually *seen* the buffer corruption when using Twisted, but the thought -occurred to me that a single corrupt buffer could hang the entire message handling process. - -- Fixed the typo "NO_REPONSE_NEEDED". I've changed it to NO_RESPONSE_NEEDED, but kept the -old variable for backwards compatibility; - -- I've also modified the string format in send() to include the '\n\n' between the header -and the body, which I think is missing (it currently has only one '\n'). - -- Added CONNECTED to VALID_COMMANDS so syncBuffer() does not decide these messages are bogus. - -- Added new unit test file teststompbuffer which covers the new functionality. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/examples/sender.py new/stomper-0.2.7/lib/stomper/examples/sender.py --- old/stomper-0.2.4/lib/stomper/examples/sender.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/examples/sender.py 2013-06-15 20:16:57.000000000 +0200 @@ -57,7 +57,7 @@ # ActiveMQ specific headers: # - # prevent the messages we send comming back to us. + # prevent the messages we send coming back to us. f.headers['activemq.noLocal'] = 'true' return f.pack() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/examples/stompbuffer-tx.py new/stomper-0.2.7/lib/stomper/examples/stompbuffer-tx.py --- old/stomper-0.2.4/lib/stomper/examples/stompbuffer-tx.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/examples/stompbuffer-tx.py 2013-06-15 20:16:57.000000000 +0200 @@ -36,7 +36,7 @@ """ stomper.Engine.connected(self, msg) - self.log.info("Connected: session %s. Begining say hello." % msg['headers']['session']) + self.log.info("Connected: session %s. Beginning say hello." % msg['headers']['session']) def setup_looping_call(): lc = LoopingCall(self.send) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/examples/stomper_usage.py new/stomper-0.2.7/lib/stomper/examples/stomper_usage.py --- old/stomper-0.2.4/lib/stomper/examples/stomper_usage.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/examples/stomper_usage.py 2013-06-15 20:16:57.000000000 +0200 @@ -44,7 +44,7 @@ # just returns an empty string. -# After a successfull connect you might want to subscribe +# After a successful connect you might want to subscribe # for messages from a destination and tell the server you'll # acknowledge all messages. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/tests/teststompbuffer.py new/stomper-0.2.7/lib/stomper/tests/teststompbuffer.py --- old/stomper-0.2.4/lib/stomper/tests/teststompbuffer.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/tests/teststompbuffer.py 2013-06-15 20:16:57.000000000 +0200 @@ -128,7 +128,7 @@ msg1 = self.putAndGetText() msg2 = self.sb.getOneMessage() self.failUnless ( msg2 is None ) - # Veryify that in fact the buffer is empty. + # Verify that in fact the buffer is empty. self.failUnless ( self.sb.bufferIsEmpty() ) @@ -141,7 +141,7 @@ msg1 = self.putAndGetBinary() msg2 = self.sb.getOneMessage() self.failUnless ( msg2 is None ) - # Veryify that in fact the buffer is empty. + # Verify that in fact the buffer is empty. self.failUnless ( self.sb.bufferIsEmpty() ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper/tests/teststomper.py new/stomper-0.2.7/lib/stomper/tests/teststomper.py --- old/stomper-0.2.4/lib/stomper/tests/teststomper.py 2010-09-28 17:58:09.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper/tests/teststomper.py 2013-06-15 20:16:57.000000000 +0200 @@ -6,7 +6,7 @@ * http://stomp.codehaus.org/Protocol I've looked and the stomp client by Jason R. Briggs and have based the message -generation on how his client did it. The client can be found at the follow +generation on how his client did it. The client can be found at the follow address however it isn't a dependancy. * http://www.briggs.net.nz/log/projects/stomppy @@ -47,10 +47,8 @@ return 'receipt' - class StomperTest(unittest.TestCase): - def testEngineToServerMessages(self): """Test the state machines reaction """ @@ -59,7 +57,10 @@ # React to a message which should be an ack: msg = stomper.Frame() msg.cmd = 'MESSAGE' - msg.headers = {'destination:':'/queue/a','message-id:':'some-message-id'} + msg.headers = { + 'destination:': '/queue/a', + 'message-id:': 'some-message-id' + } msg.body = "hello queue a" rc = e.react(msg.pack()) @@ -69,7 +70,7 @@ # React to an error: error = stomper.Frame() error.cmd = 'ERROR' - error.headers = {'mesage:':'malformed packet received!'} + error.headers = {'message:': 'malformed packet received!'} error.body = """The message: ----- MESSAGE @@ -77,7 +78,7 @@ Hello queue a! ----- -Did not contain a destination header, which is required for message propagation. +Did not contain a destination header, which is required for message propagation. \x00 """ @@ -88,13 +89,12 @@ # React to an receipt: receipt = stomper.Frame() receipt.cmd = 'RECEIPT' - receipt.headers = {'receipt-id:':'message-12345'} - + receipt.headers = {'receipt-id:': 'message-12345'} + rc = e.react(receipt.pack()) self.assertEquals(rc, 'receipt') self.assertEquals(e.receiptCalled, True) - def testEngine(self): """Test the basic state machine. """ @@ -111,7 +111,6 @@ returned = e.react(result) self.assertEquals(returned, correct) - # test message: msg = """MESSAGE destination: /queue/a @@ -125,7 +124,6 @@ correct = 'ACK\nmessage-id: some-message-id\n\n\x00\n' self.assertEquals(returned, correct) - # test error: msg = """ERROR message:some error @@ -137,7 +135,7 @@ returned = e.react(msg) correct = 'error' self.assertEquals(returned, correct) - + # test receipt: msg = """RECEIPT message-id: some-message-id @@ -148,39 +146,40 @@ correct = 'receipt' self.assertEquals(returned, correct) - def testFramepack1(self): """Testing pack, unpacking and the Frame class. """ # Check bad frame generation: - frame = stomper.Frame() + frame = stomper.Frame() + def bad(): frame.cmd = 'SOME UNNOWN CMD' + self.assertRaises(stomper.FrameError, bad) # Generate a MESSAGE frame: - frame = stomper.Frame() + frame = stomper.Frame() frame.cmd = 'MESSAGE' frame.headers['destination'] = '/queue/a' frame.headers['message-id'] = 'card_data' frame.body = "hello queue a" result = frame.pack() - + # print "\n-- result " + "----" * 10 # pprint.pprint(result) # print # Try bad message unpack catching: - bad_frame = stomper.Frame() + bad_frame = stomper.Frame() self.assertRaises(stomper.FrameError, bad_frame.unpack, None) - self.assertRaises(stomper.FrameError, bad_frame.unpack, '') + self.assertRaises(stomper.FrameError, bad_frame.unpack, '') # Try to read the generated frame back in # and then check the variables are set up # correctly: - frame2 = stomper.Frame() + frame2 = stomper.Frame() frame2.unpack(result) - + self.assertEquals(frame2.cmd, 'MESSAGE') self.assertEquals(frame2.headers['destination'], '/queue/a') self.assertEquals(frame2.headers['message-id'], 'card_data') @@ -188,24 +187,33 @@ result = frame2.pack() correct = "MESSAGE\ndestination:/queue/a\nmessage-id:card_data\n\nhello queue a\x00\n" - + # print "result: " # pprint.pprint(result) # print # print "correct: " # pprint.pprint(correct) -# print +# print # self.assertEquals(result, correct) result = stomper.unpack_frame(result) - + self.assertEquals(result['cmd'], 'MESSAGE') self.assertEquals(result['headers']['destination'], '/queue/a') self.assertEquals(result['headers']['message-id'], 'card_data') self.assertEquals(result['body'], 'hello queue a') - - + + def testFramepack2(self): + """Testing pack, unpacking and the Frame class. + """ + # Check bad frame generation: + frame = stomper.Frame() + frame.cmd = 'DISCONNECT' + result = frame.pack() + correct = 'DISCONNECT\n\n\x00\n' + self.assertEquals(result, correct) + def testFrameUnpack2(self): """Testing unpack frame function against MESSAGE """ @@ -216,13 +224,12 @@ hello queue a""" result = stomper.unpack_frame(msg) - + self.assertEquals(result['cmd'], 'MESSAGE') self.assertEquals(result['headers']['destination'], '/queue/a') self.assertEquals(result['headers']['message-id'], 'card_data') self.assertEquals(result['body'], 'hello queue a') - - + def testFrameUnpack3(self): """Testing unpack frame function against CONNECTED """ @@ -230,12 +237,11 @@ session:ID:snorky.local-49191-1185461799654-3:18 """ result = stomper.unpack_frame(msg) - + self.assertEquals(result['cmd'], 'CONNECTED') self.assertEquals(result['headers']['session'], 'ID:snorky.local-49191-1185461799654-3:18') self.assertEquals(result['body'], '') - - + def testBugInFrameUnpack1(self): msg = """MESSAGE destination:/queue/a @@ -246,14 +252,13 @@ \x00 """ result = stomper.unpack_frame(msg) - + self.assertEquals(result['cmd'], 'MESSAGE') self.assertEquals(result['headers']['destination'], '/queue/a') self.assertEquals(result['headers']['message-id'], 'card_data') self.assertEquals(result['body'], 'hello queue a') - - def testCommit(self): + def testCommit(self): transactionid = '1234' correct = "COMMIT\ntransaction: %s\n\n\x00\n" % transactionid self.assertEquals(stomper.commit(transactionid), correct) @@ -267,11 +272,11 @@ transactionid = '1234' correct = "BEGIN\ntransaction: %s\n\n\x00\n" % transactionid self.assertEquals(stomper.begin(transactionid), correct) - + def testAck(self): messageid = '1234' transactionid = '9876' - header = 'message-id: %s\ntransaction: %s' % (messageid, transactionid) + header = 'message-id: %s\ntransaction: %s' % (messageid, transactionid) correct = "ACK\n%s\n\n\x00\n" % header self.assertEquals(stomper.ack(messageid, transactionid), correct) @@ -296,42 +301,32 @@ correct = "SUBSCRIBE\ndestination: %s\nack: %s\n\n\x00\n" % (dest, ack) self.assertEquals(stomper.subscribe(dest), correct) - def testConnect(self): username, password = 'bob', '123' correct = "CONNECT\nlogin:%s\npasscode:%s\n\n\x00\n" % (username, password) self.assertEquals(stomper.connect(username, password), correct) - def testDisconnect(self): correct = "DISCONNECT\n\n\x00\n" self.assertEquals(stomper.disconnect(), correct) - def testSend(self): dest, transactionid, msg = '/queue/myplace', '', '123 456 789' correct = "SEND\ndestination: %s\n\n%s\n%s\x00\n" % (dest, '', msg) result = stomper.send(dest, msg, transactionid) - + # print "result: " # pprint.pprint(result) # print # print "correct: " # pprint.pprint(correct) -# print - +# print self.assertEquals(result, correct) dest, transactionid, msg = '/queue/myplace', '987', '123 456 789' correct = "SEND\ndestination: %s\ntransaction: %s\n\n%s\x00\n" % (dest, transactionid, msg) self.assertEquals(stomper.send(dest, msg, transactionid), correct) - - - - if __name__ == "__main__": unittest.main() - - \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper.egg-info/PKG-INFO new/stomper-0.2.7/lib/stomper.egg-info/PKG-INFO --- old/stomper-0.2.4/lib/stomper.egg-info/PKG-INFO 2010-09-28 18:23:27.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper.egg-info/PKG-INFO 2013-06-17 15:34:18.000000000 +0200 @@ -1,8 +1,8 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: stomper -Version: 0.2.4 +Version: 0.2.7 Summary: This is a transport neutral client implementation of the STOMP protocol. -Home-page: http://code.google.com/p/stomper +Home-page: https://github.com/oisinmulvihill/stomper Author: Oisin Mulvihill Author-email: oisin dot mulvihill at gmail com License: http://www.apache.org/licenses/LICENSE-2.0 @@ -10,14 +10,18 @@ Stomper ======= - .. content: + .. contents:: :Author: - Oisin Mulvihill + Oisin Mulvihill Contributors: - Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, - Arfrever Frehtes Taifersar Arahesis <arfrever dot fta at gmail dot com> + Micheal Twomey, Ricky Iacovou <iacovou at gmail dot com>, + Arfrever Frehtes <arfrever dot fta at gmail dot com>, + Niki Pore <niki pore at gmail dot com>, + Simon Chopin, + Arfrever <https://github.com/Arfrever>, + Ian Weller <https://github.com/ianweller>, Introduction @@ -26,7 +30,7 @@ This is a python client implementation of the STOMP protocol. The client is attempting to be transport layer neutral. This module provides - functions to create and parse STOMP messages in a programatic fashion. The + functions to create and parse STOMP messages in a programmatic fashion. The messages can be easily generated and parsed, however its up to the user to do the sending and receiving. The STOMP protocol specification can be found here: @@ -34,7 +38,7 @@ I've looked at the stomp client by Jason R. Briggs. I've based some of the 'function to message' generation on how his client does it. The client can - be found at the follow address however it isn't a dependancy. + be found at the follow address however it isn't a dependency. - `stompy <http://www.briggs.net.nz/log/projects/stomppy>`_ @@ -79,10 +83,32 @@ Version History --------------- + 0.2.7 + ~~~~~ + + I forgot to add a MANIFEST.in which makes sure README.md is present. Without + this pip install fails: https://github.com/oisinmulvihill/stomper/issues/3. + Thanks to Ian Weller for noticing this. I've also added in the fix suggested + by Arfrever https://github.com/oisinmulvihill/stomper/issues/1. + + + 0.2.6 + ~~~~~ + + Add contributed fixes from Simon Chopin. He corrected many spelling mistakes + throughout the code base. I've also made the README.md the main + + 0.2.5 + ~~~~~ + + Add the contributed fix for issue #14 by Niki Pore. The issue was reported by + Roger Hoover. This removes the extra line ending which can cause problems. + + 0.2.4 ~~~~~ - OM: A minor relase fixing the problem whereby uuid would be installed on python2.5+. It + OM: A minor release fixing the problem whereby uuid would be installed on python2.5+. It is not needed after python2.4 as it comes with python. Arfrever Frehtes Taifersar Arahesis contributed the fix for this. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/lib/stomper.egg-info/SOURCES.txt new/stomper-0.2.7/lib/stomper.egg-info/SOURCES.txt --- old/stomper-0.2.4/lib/stomper.egg-info/SOURCES.txt 2010-09-28 18:23:27.000000000 +0200 +++ new/stomper-0.2.7/lib/stomper.egg-info/SOURCES.txt 2013-06-17 15:34:18.000000000 +0200 @@ -1,4 +1,5 @@ -README +MANIFEST.in +README.md runtests.py setup.py lib/stomper/__init__.py @@ -8,8 +9,6 @@ lib/stomper.egg-info/SOURCES.txt lib/stomper.egg-info/dependency_links.txt lib/stomper.egg-info/top_level.txt -lib/stomper/doc/__init__.py -lib/stomper/doc/stomper.stx lib/stomper/examples/__init__.py lib/stomper/examples/receiver.py lib/stomper/examples/sender.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stomper-0.2.4/setup.py new/stomper-0.2.7/setup.py --- old/stomper-0.2.4/setup.py 2010-09-28 18:21:05.000000000 +0200 +++ new/stomper-0.2.7/setup.py 2013-06-17 15:30:51.000000000 +0200 @@ -9,16 +9,22 @@ from setuptools import setup, find_packages -Name='stomper' -ProjecUrl="http://code.google.com/p/stomper" -Version='0.2.4' # alpha release -Author='Oisin Mulvihill' -AuthorEmail='oisin dot mulvihill at gmail com' -Maintainer=' Oisin Mulvihill' -Summary='This is a transport neutral client implementation of the STOMP protocol.' -License='http://www.apache.org/licenses/LICENSE-2.0' -ShortDescription="This is a transport neutral client implementation of the STOMP protocol." -Classifiers=[ +Name = 'stomper' +ProjectUrl = "https://github.com/oisinmulvihill/stomper" +Version = '0.2.7' +Author = 'Oisin Mulvihill' +AuthorEmail = 'oisin dot mulvihill at gmail com' +Maintainer = 'Oisin Mulvihill' +Summary = ( + 'This is a transport neutral client implementation ' + 'of the STOMP protocol.' +) +License = 'http://www.apache.org/licenses/LICENSE-2.0' +ShortDescription = ( + "This is a transport neutral client implementation of the " + "STOMP protocol." +) +Classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", @@ -26,8 +32,8 @@ ] # Recover the ReStructuredText docs: -fd = file("lib/stomper/doc/stomper.stx") -Description=fd.read() +fd = file("README.md") +Description = fd.read() fd.close() TestSuite = 'stomper.tests' @@ -35,14 +41,9 @@ # stop any logger not found messages if tests are run. #stomper.utils.log_init(logging.CRITICAL) - -ProjectScripts = [ -# '', -] +ProjectScripts = [] PackageData = { - # If any package contains *.txt or *.rst files, include them: - 'stomper': ['doc/*.stx',], } @@ -53,14 +54,13 @@ ] setup( -# url=ProjecUrl, name=Name, version=Version, author=Author, author_email=AuthorEmail, description=ShortDescription, long_description=Description, - url=ProjecUrl, + url=ProjectUrl, license=License, classifiers=Classifiers, install_requires=needed, @@ -68,7 +68,5 @@ scripts=ProjectScripts, packages=find_packages('lib'), package_data=PackageData, - package_dir = {'': 'lib'}, + package_dir={'': 'lib'}, ) - - -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org