[Python-modules-commits] r16049 - in packages/kombu/branches/anyjson/debian (4 files)

fladi-guest at users.alioth.debian.org fladi-guest at users.alioth.debian.org
Mon Mar 7 12:38:23 UTC 2011


    Date: Monday, March 7, 2011 @ 12:38:13
  Author: fladi-guest
Revision: 16049

Initial patch to replace anyjson.

Added:
  packages/kombu/branches/anyjson/debian/patches/replace_anyjson.patch
Modified:
  packages/kombu/branches/anyjson/debian/changelog
  packages/kombu/branches/anyjson/debian/control
  packages/kombu/branches/anyjson/debian/patches/series

Modified: packages/kombu/branches/anyjson/debian/changelog
===================================================================
--- packages/kombu/branches/anyjson/debian/changelog	2011-03-07 12:36:32 UTC (rev 16048)
+++ packages/kombu/branches/anyjson/debian/changelog	2011-03-07 12:38:13 UTC (rev 16049)
@@ -1,3 +1,9 @@
+kombu (1.0.4-2) UNRELEASED; urgency=low
+
+  * Replace anyjson with simplejson/built-in json.
+
+ -- Fladischer Michael <FladischerMichael at fladi.at>  Mon, 07 Mar 2011 13:37:44 +0100
+
 kombu (1.0.4-1) unstable; urgency=low
 
   * Initial release (Closes: #611809)

Modified: packages/kombu/branches/anyjson/debian/control
===================================================================
--- packages/kombu/branches/anyjson/debian/control	2011-03-07 12:36:32 UTC (rev 16048)
+++ packages/kombu/branches/anyjson/debian/control	2011-03-07 12:38:13 UTC (rev 16049)
@@ -14,7 +14,6 @@
                python-sphinx,
                python-unittest2,
                python-yaml
-Build-Conflicts: python-cjson
 X-Python-Version: >= 2.4
 Standards-Version: 3.9.1
 Homepage: http://github.com/ask/kombu/
@@ -24,12 +23,11 @@
 Package: python-kombu
 Architecture: all
 Depends: python-amqplib (>= 0.6),
-         python-anyjson,
+         python (>= 2.6) | python-simplejson,
          ${misc:Depends},
          ${python:Depends}
-Recommends: python-simplejson, python-yaml
-Breaks: python-cjson, ${python:Breaks}
-Suggests: python-kombu-doc, python-pymongo
+Breaks: ${python:Breaks}
+Suggests: python-kombu-doc, python-yaml, python-pymongo
 Description: AMQP Messaging Framework for Python
  The aim of Kombu is to make messaging in Python as easy as possible by
  providing an idiomatic high-level interface for the AMQP protocol. It is meant

Added: packages/kombu/branches/anyjson/debian/patches/replace_anyjson.patch
===================================================================
--- packages/kombu/branches/anyjson/debian/patches/replace_anyjson.patch	                        (rev 0)
+++ packages/kombu/branches/anyjson/debian/patches/replace_anyjson.patch	2011-03-07 12:38:13 UTC (rev 16049)
@@ -0,0 +1,142 @@
+--- a/kombu/serialization.py
++++ b/kombu/serialization.py
+@@ -239,8 +239,10 @@
+ 
+ def register_json():
+     """Register a encoder/decoder for JSON serialization."""
+-    from anyjson import serialize as json_serialize
+-    from anyjson import deserialize as json_deserialize
++    try:
++        from json import dumps as json_serialize, loads as json_deserialize
++    except ImportError:
++        from simplejson import dumps as json_serialize, loads as json_deserialize
+ 
+     registry.register('json', json_serialize, json_deserialize,
+                       content_type='application/json',
+--- a/kombu/tests/mocks.py
++++ b/kombu/tests/mocks.py
+@@ -1,6 +1,9 @@
+ from itertools import count
+ 
+-import anyjson
++try:
++    import json
++except ImportError:
++    import simplejson as json
+ 
+ from kombu.transport import base
+ 
+@@ -93,7 +96,7 @@
+ 
+     def message_to_python(self, message, *args, **kwargs):
+         self._called("message_to_python")
+-        return Message(self, body=anyjson.serialize(message),
++        return Message(self, body=json.dumps(message),
+                 delivery_tag=self.deliveries(),
+                 throw_decode_error=self.throw_decode_error,
+                 content_type="application/json", content_encoding="utf-8")
+--- a/kombu/tests/test_messaging.py
++++ b/kombu/tests/test_messaging.py
+@@ -1,6 +1,9 @@
+ from kombu.tests.utils import unittest
+ 
+-import anyjson
++try:
++    import json
++except ImportError:
++    import simplejson as json
+ 
+ from kombu.connection import BrokerConnection
+ from kombu.exceptions import MessageStateError
+@@ -44,7 +47,7 @@
+         channel = self.connection.channel()
+         p = Producer(channel, self.exchange, serializer="json")
+         m, ctype, cencoding = p._prepare(message, headers={})
+-        self.assertDictEqual(message, anyjson.deserialize(m))
++        self.assertDictEqual(message, json.loads(m))
+         self.assertEqual(ctype, "application/json")
+         self.assertEqual(cencoding, "utf-8")
+ 
+@@ -59,7 +62,7 @@
+         self.assertEqual(cencoding, "utf-8")
+         self.assertEqual(headers["compression"], "application/x-gzip")
+         import zlib
+-        self.assertEqual(anyjson.deserialize(
++        self.assertEqual(json.loads(
+                             zlib.decompress(m).decode("utf-8")), message)
+ 
+     def test_prepare_custom_content_type(self):
+@@ -99,7 +102,7 @@
+         self.assertIn("basic_publish", channel)
+ 
+         m, exc, rkey = ret
+-        self.assertDictEqual(message, anyjson.deserialize(m["body"]))
++        self.assertDictEqual(message, json.loads(m["body"]))
+         self.assertDictContainsSubset({"content_type": "application/json",
+                                        "content_encoding": "utf-8",
+                                        "priority": 0}, m)
+@@ -374,7 +377,7 @@
+ 
+         self.assertTrue(thrown)
+         m, exc = thrown[0]
+-        self.assertEqual(anyjson.deserialize(m), {"foo": "bar"})
++        self.assertEqual(json.loads(m), {"foo": "bar"})
+         self.assertIsInstance(exc, ValueError)
+ 
+     def test_recover(self):
+--- a/kombu/transport/beanstalk.py
++++ b/kombu/transport/beanstalk.py
+@@ -12,7 +12,10 @@
+ 
+ from Queue import Empty
+ 
+-from anyjson import serialize, deserialize
++try:
++    from json import dumps as serialize, loads as deserialize
++except ImportError:
++    from simplejson import dumps as serialize, loads as deserialize
+ from beanstalkc import Connection, BeanstalkcException, SocketError
+ 
+ from kombu.transport import virtual
+--- a/kombu/transport/mongodb.py
++++ b/kombu/transport/mongodb.py
+@@ -11,7 +11,10 @@
+ """
+ from Queue import Empty
+ 
+-from anyjson import serialize, deserialize
++try:
++    from json import dumps as serialize, loads as deserialize
++except ImportError:
++    from simplejson import dumps as serialize, loads as deserialize
+ from pymongo import errors
+ from pymongo.connection import Connection
+ 
+--- a/kombu/transport/pycouchdb.py
++++ b/kombu/transport/pycouchdb.py
+@@ -13,7 +13,10 @@
+ import socket
+ import couchdb
+ 
+-from anyjson import serialize, deserialize
++try:
++    from json import dumps as serialize, loads as deserialize
++except ImportError:
++    from simplejson import dumps as serialize, loads as deserialize
+ 
+ from kombu.transport import virtual
+ from kombu.utils import uuid4
+--- a/kombu/transport/pyredis.py
++++ b/kombu/transport/pyredis.py
+@@ -12,7 +12,10 @@
+ from itertools import imap
+ from Queue import Empty
+ 
+-from anyjson import serialize, deserialize
++try:
++    from json import dumps as serialize, loads as deserialize
++except ImportError:
++    from simplejson import dumps as serialize, loads as deserialize
+ 
+ from kombu.transport import virtual
+ from kombu.utils import eventio

Modified: packages/kombu/branches/anyjson/debian/patches/series
===================================================================
--- packages/kombu/branches/anyjson/debian/patches/series	2011-03-07 12:36:32 UTC (rev 16048)
+++ packages/kombu/branches/anyjson/debian/patches/series	2011-03-07 12:38:13 UTC (rev 16049)
@@ -1 +1,2 @@
 remove_nose-cover3.patch
+replace_anyjson.patch




More information about the Python-modules-commits mailing list