[h5py] 445/455: Update doc system for sphinx 0.6
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.
commit e29ca28b99d334d2388567426902da58008e2521
Author: andrewcollette <andrew.collette at gmail.com>
Date: Sun Mar 14 00:33:15 2010 +0000
Update doc system for sphinx 0.6
---
docs/source/_static/navigation.png | Bin 0 -> 218 bytes
docs/source/automod.py | 36 ++++++++++++++++--------------------
docs/source/conf.py | 9 ++++++---
3 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/docs/source/_static/navigation.png b/docs/source/_static/navigation.png
new file mode 100644
index 0000000..1081dc1
Binary files /dev/null and b/docs/source/_static/navigation.png differ
diff --git a/docs/source/automod.py b/docs/source/automod.py
index fcf74a5..0fb4839 100644
--- a/docs/source/automod.py
+++ b/docs/source/automod.py
@@ -180,6 +180,8 @@ def replace_param(istr):
# === Begin Sphinx extension code =============================================
+def is_callable(docstring):
+ return str(docstring).strip().startswith('(')
def setup(spx):
@@ -189,7 +191,7 @@ def setup(spx):
final_lines = lines[:]
# Remove the signature lines from the docstring
- if what in ("function", "method") and lines[0].strip().startswith('('):
+ if is_callable(obj.__doc__):
doclines = []
arglines = []
final_lines = arglines
@@ -199,7 +201,6 @@ def setup(spx):
final_lines.append(line)
# Resolve class names, constants and modules
- #print name
if hasattr(obj, 'im_class'):
mod = obj.im_class.__module__
elif hasattr(obj, '__module__'):
@@ -217,7 +218,6 @@ def setup(spx):
line = line.replace('**kwds', '\*\*kwds').replace('*args','\*args')
lines.append(line)
- #print "\n".join(lines)
@@ -226,7 +226,7 @@ def setup(spx):
def getsig(docstring):
""" Get (sig, return) from a docstring, or None. """
- if docstring is None or not docstring.strip().startswith('('):
+ if not is_callable(docstring):
return None
lines = []
@@ -234,26 +234,22 @@ def setup(spx):
if len(line.strip()) == 0:
break
lines.append(line)
- sig = [x.strip() for x in " ".join(lines).split('=>')]
- ret = ''
- if len(sig) == 2:
- sig, ret = sig
- ret = " -> "+ret
+ rawsig = " ".join(x.strip() for x in lines)
+
+ if '=>' in rawsig:
+ sig, ret = tuple(x.strip() for x in rawsig.split('=>'))
+ elif '->' in rawsig:
+ sig, ret = tuple(x.strip() for x in rawsig.split('->'))
else:
- sig = sig[0]
- if len(sig) == 2: sig = sig[0]+" "+sig[1] # autodoc hates "()"
- return (sig, ret)
+ sig = rawsig
+ ret = None
- if what not in ("function", "method"):
- return None
+ if sig == "()":
+ sig = "( )" # Why? Ask autodoc.
- sigtuple = getsig(obj.__doc__)
+ return (sig, ret)
- # If it's a built-in fuction it MUST have a docstring or
- # Sphinx shits a giant red box into the HTML
- if sigtuple is None and \
- (not (hasattr(obj, 'im_func') or hasattr(obj, 'func_code'))):
- return ('(...)', '')
+ sigtuple = getsig(obj.__doc__)
return sigtuple
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 8cefcf9..e09dbf8 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -15,6 +15,9 @@ import sys, os
pth = os.getenv('H5PY_PATH', None)
if pth is not None:
sys.path[:] = [pth]+sys.path
+sys.path[:] = sys.path+[os.path.abspath('.')]
+
+import h5py
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
@@ -26,7 +29,7 @@ if pth is not None:
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-sys.path += [os.path.abspath('.')]
+
extensions = ['sphinx.ext.autodoc', 'automod']
# Add any paths that contain templates here, relative to this directory.
@@ -46,9 +49,9 @@ copyright = '2010, Andrew Collette'
# other places throughout the built documents.
#
# The short X.Y version.
-version = '1.3'
+version = ".".join(str(x) for x in h5py.version.version_tuple[0:2])
# The full version, including alpha/beta/rc tags.
-release = '1.3.0'
+release = h5py.version.version
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git
More information about the debian-science-commits
mailing list