summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Plociniczak <hubert@lshift.net>2008-11-20 13:32:47 +0000
committerHubert Plociniczak <hubert@lshift.net>2008-11-20 13:32:47 +0000
commit21e03a244860de5a07b36d9459b6ed305ebd337d (patch)
treed7175ea086db6089b70e01df96081c3ee94ca461
parent8757f9d0b38c5e378519fb399cd6a7d7b12dbe24 (diff)
downloadrabbitmq-codegen-21e03a244860de5a07b36d9459b6ed305ebd337d.tar.gz
Use simplejson.py API, move copyright info
since comments are not valid in json
-rw-r--r--amqp-0.8.json60
-rw-r--r--amqp_codegen.py19
2 files changed, 42 insertions, 37 deletions
diff --git a/amqp-0.8.json b/amqp-0.8.json
index fa4b58d..9ff3272 100644
--- a/amqp-0.8.json
+++ b/amqp-0.8.json
@@ -1,39 +1,37 @@
-/*
- Copyright (c) 2008 John Leuner
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this file (the "Software"), to deal in the
- Software without restriction, including without limitation the
- rights to use, copy, modify, merge, publish, distribute,
- sublicense, and/or sell copies of the Software, and to permit
- persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf
-
- b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf
- http://www.twiststandards.org/index.php?option=com_docman&task=cat_view&gid=28&&Itemid=90
- 8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf
- https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1
-*/
-
{
"name": "AMQP",
"major-version": 8,
"minor-version": 0,
"port": 5672,
+ "copyright":"
+ Copyright (c) 2008 John Leuner
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this file (the \"Software\"), to deal in the
+ Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute,
+ sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+ Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf
+
+ b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf
+ http://www.twiststandards.org/index.php?option=com_docman&task=cat_view&gid=28&&Itemid=90
+ 8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf
+ https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1",
"domains": [
["access-ticket", "short"],
diff --git a/amqp_codegen.py b/amqp_codegen.py
index a2f920f..c4a3846 100644
--- a/amqp_codegen.py
+++ b/amqp_codegen.py
@@ -28,14 +28,21 @@ import re
import sys
try:
- import json
+ try:
+ import simplejson as json
+ except ImportError, e:
+ if sys.hexversion >= 0x20600f0:
+ import json
+ else:
+ raise e
except ImportError:
- print >> sys.stderr , " You don't appear to have json.py installed"
+ print >> sys.stderr , " You don't appear to have simplejson.py installed"
print >> sys.stderr , " (an implementation of a JSON reader and writer in Python)."
print >> sys.stderr , " You can install it:"
- print >> sys.stderr , " - by running 'apt-get install python-json' on Debian-based systems,"
- print >> sys.stderr , " - by running 'yum install python-json' on Fedora/Red Hat system,"
- print >> sys.stderr , " - from sources from 'http://sourceforge.net/projects/json-py'"
+ print >> sys.stderr , " - by running 'apt-get install python-simplejson' on Debian-based systems,"
+ print >> sys.stderr , " - by running 'yum install python-simplejson' on Fedora/Red Hat system,"
+ print >> sys.stderr , " - from sources from 'http://pypi.python.org/pypi/simplejson'"
+ print >> sys.stderr , " - simplejson is a standard json library in the Python core since 2.6"
sys.exit(1)
def insert_base_types(d):
@@ -45,7 +52,7 @@ def insert_base_types(d):
class AmqpSpec:
def __init__(self, filename):
- self.spec = json.read(file(filename).read())
+ self.spec = json.load(file(filename))
self.major = self.spec['major-version']
self.minor = self.spec['minor-version']