use Sphinx for 'setup.py doc'

This commit is contained in:
Mike Dirolf 2009-11-11 18:07:38 -05:00
parent 4652b54bb9
commit eee5b5ba7f
3 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,7 @@
:mod:`json_util` -- Tools for using Python's json module with MongoDB documents
===============================================================================
:mod:`json_util` -- Tools for using Python's :mod:`json` module with MongoDB documents
======================================================================================
.. automodule:: pymongo.json_util
:synopsis: Tools for using Python's json module with MongoDB documents
:members:
:undoc-members:

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tools for using the json (or simplejson) module with MongoDB documents.
"""Tools for using Python's :mod:`json` module with MongoDB documents.
This module provides two methods: `object_hook` and `default`. These names are
pretty terrible, but match the names used in Python's `json library
@ -22,10 +22,12 @@ encoding and decoding of MongoDB documents into `Mongo Extended JSON
This lets you encode / decode MongoDB documents to JSON even when they use
special PyMongo types.
Example usage (serialization):
Example usage (serialization)::
>>> json.dumps(..., default=json_util.default)
Example usage (deserialization):
Example usage (deserialization)::
>>> json.loads(..., object_hook=json_util.object_hook)
Currently this only handles special encoding and decoding for ObjectId and

View File

@ -49,13 +49,19 @@ class GenerateDoc(Command):
pass
def run(self):
path = "doc/%s" % version
path = "doc/_build/%s" % version
shutil.rmtree("doc", ignore_errors=True)
os.makedirs(path)
# shutil.rmtree("doc/_build", ignore_errors=True)
try:
os.makedirs(path)
except:
pass
if has_subprocess:
subprocess.call(["epydoc", "--config", "epydoc-config", "-o", path])
subprocess.call(["sphinx-build", "-b", "html", "doc", path])
print ""
print "Documentation generated:"
print " %s/index.html" % path
else:
print """
`setup.py doc` is not supported for this version of Python.