summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRune Halvorsen <runefh@gmail.com>2009-07-23 00:11:44 +0200
committerRune Halvorsen <runefh@gmail.com>2009-07-23 00:11:44 +0200
commit35852a3a3cf438ab7bd4765d497dca2b6841962d (patch)
treeac05b15475e7a1b80be249bbd52a47a7061e9a2a
parenta1cb4a799838d1a905264c7fb7547416c48b442b (diff)
downloadanyjson-35852a3a3cf438ab7bd4765d497dca2b6841962d.tar.gz
Removed support for -m since we're a package now and so it doesn't
work. (add a command line entry point later on if we really need that functionality) Moved parts of the docs back to __init__.py
-rw-r--r--anyjson/__init__.py40
-rw-r--r--anyjson/metadata.py21
2 files changed, 22 insertions, 39 deletions
diff --git a/anyjson/__init__.py b/anyjson/__init__.py
index 40cce49..bc74885 100644
--- a/anyjson/__init__.py
+++ b/anyjson/__init__.py
@@ -6,6 +6,24 @@ __doc__ = metadata.__doc__
implementation = None
"""
+.. function:: serialize(obj)
+
+ Serialize the object to JSON.
+
+.. function:: deserialize(str)
+
+ Deserialize JSON-encoded object to a Python object.
+
+.. function:: force_implementation(name)
+
+ Load a specific json module. This is useful for testing and not much else
+
+.. attribute:: implementation
+
+ The json implementation object. This is probably not useful to you,
+ except to get the name of the implementation in use. The name is
+ available through `implementation.name`.
+
.. data:: _modules
List of known json modules, and the names of their serialize/unserialize
@@ -80,29 +98,13 @@ def force_implementation(modname):
raise ImportError("No module named: %s" % modname)
-
-def main():
- installed = []
- for modspec in _modules:
- try:
- __import__(modspec[0])
- installed.append(modspec[0])
- except ImportError:
- pass
-
- if installed:
- print "Supported JSON modules found:", ", ".join(installed)
- return 0
- else:
- print "No supported JSON modules found"
- return 1
-
if __name__ == "__main__":
- # If run as a script, we simply print what is installed that we support.
+ # If run as a script, we do nothing but print an error message.
# We do NOT try to load a compatible module because that may throw an
# exception, which renders the package uninstallable with easy_install
# (It trys to execfile the script when installing, to make sure it works)
- sys.exit(main())
+ print "Running anyjson as a stand alone script is not supported"
+ sys.exit(1)
else:
for modspec in _modules:
try:
diff --git a/anyjson/metadata.py b/anyjson/metadata.py
index a23b135..f44766b 100644
--- a/anyjson/metadata.py
+++ b/anyjson/metadata.py
@@ -1,24 +1,5 @@
"""Wraps the best available JSON implementation available in a common
-interface
-
-.. function:: serialize(obj)
-
- Serialize the object to JSON.
-
-.. function:: deserialize(str)
-
- Deserialize JSON-encoded object to a Python object.
-
-.. function:: force_implementation(name)
-
- Load a specific json module. This is useful for testing and not much else
-
-.. attribute:: implementation
-
- The json implementation object. This is probably not useful to you,
- except to get the name of the implementation in use. The name is
- available through `implementation.name`.
-"""
+interface"""
# Note: This module is neccessary so we can load the metadata in setup.py
# without risking that the module loading fails. It will fail if the user