[Python-modules-commits] r15745 - in packages/sphinx/branches/1.0/debian (3 files)

jwilk at users.alioth.debian.org jwilk at users.alioth.debian.org
Thu Feb 17 14:26:23 UTC 2011


    Date: Thursday, February 17, 2011 @ 14:26:20
  Author: jwilk
Revision: 15745

Revert changes to the autosummary extension introduced in 1.0.7.

Added:
  packages/sphinx/branches/1.0/debian/patches/autosummary_1.0.6.patch
Modified:
  packages/sphinx/branches/1.0/debian/changelog
  packages/sphinx/branches/1.0/debian/patches/series

Modified: packages/sphinx/branches/1.0/debian/changelog
===================================================================
--- packages/sphinx/branches/1.0/debian/changelog	2011-02-17 11:10:25 UTC (rev 15744)
+++ packages/sphinx/branches/1.0/debian/changelog	2011-02-17 14:26:20 UTC (rev 15745)
@@ -9,8 +9,10 @@
     Frederic-Emmanuel Picca for the bug report.
   * Drop preinst script to remove python-central leftovers; not needed
     anymore.
+  * Revert changes to the autosummary extension introduced in 1.0.7
+    (closes: #611078).
 
- -- Jakub Wilk <jwilk at debian.org>  Wed, 16 Feb 2011 23:18:44 +0100
+ -- Jakub Wilk <jwilk at debian.org>  Thu, 17 Feb 2011 15:18:56 +0100
 
 sphinx (1.0.7-1) experimental; urgency=low
 

Added: packages/sphinx/branches/1.0/debian/patches/autosummary_1.0.6.patch
===================================================================
--- packages/sphinx/branches/1.0/debian/patches/autosummary_1.0.6.patch	                        (rev 0)
+++ packages/sphinx/branches/1.0/debian/patches/autosummary_1.0.6.patch	2011-02-17 14:26:20 UTC (rev 15745)
@@ -0,0 +1,158 @@
+Description: Revert upstream commit 44d16909cf74 (“fix wrong generation of
+  directives of static methods in autosummary”).
+Bug-Debian: http://bugs.debian.org/611078
+Bug: https://bitbucket.org/birkenfeld/sphinx/issue/618
+Forwarded: not-needed
+
+--- a/CHANGES
++++ b/CHANGES
+@@ -1,9 +1,6 @@
+ Release 1.0.7 (Jan 15, 2011)
+ ============================
+ 
+-* #347: Fix wrong generation of directives of static methods in
+-  autosummary.
+-
+ * #599: Import PIL as ``from PIL import Image``.
+ 
+ * #558: Fix longtables with captions in LaTeX output.
+--- a/sphinx/ext/autosummary/__init__.py
++++ b/sphinx/ext/autosummary/__init__.py
+@@ -134,19 +134,27 @@
+         return False
+     isgetsetdescriptor = ismemberdescriptor
+ 
+-def get_documenter(obj, parent):
++def get_documenter(obj):
+     """
+     Get an autodoc.Documenter class suitable for documenting the given object
+     """
+-    from sphinx.ext.autodoc import AutoDirective, DataDocumenter
++    import sphinx.ext.autodoc as autodoc
+ 
+-    classes = [cls for cls in AutoDirective._registry.values()
+-               if cls.can_document_member(obj, '', False, parent)]
+-    if classes:
+-        classes.sort(key=lambda cls: cls.priority)
+-        return classes[-1]
++    if inspect.isclass(obj):
++        if issubclass(obj, Exception):
++            return autodoc.ExceptionDocumenter
++        return autodoc.ClassDocumenter
++    elif inspect.ismodule(obj):
++        return autodoc.ModuleDocumenter
++    elif inspect.ismethod(obj) or inspect.ismethoddescriptor(obj):
++        return autodoc.MethodDocumenter
++    elif (ismemberdescriptor(obj) or isgetsetdescriptor(obj)
++          or inspect.isdatadescriptor(obj)):
++        return autodoc.AttributeDocumenter
++    elif inspect.isroutine(obj):
++        return autodoc.FunctionDocumenter
+     else:
+-        return DataDocumenter
++        return autodoc.DataDocumenter
+ 
+ 
+ # -- .. autosummary:: ----------------------------------------------------------
+@@ -232,7 +240,7 @@
+                 display_name = name.split('.')[-1]
+ 
+             try:
+-                real_name, obj, parent = import_by_name(name, prefixes=prefixes)
++                obj, real_name = import_by_name(name, prefixes=prefixes)
+             except ImportError:
+                 self.warn('failed to import %s' % name)
+                 items.append((name, '', '', name))
+@@ -240,7 +248,7 @@
+ 
+             # NB. using real_name here is important, since Documenters
+             #     handle module prefixes slightly differently
+-            documenter = get_documenter(obj, parent)(self, real_name)
++            documenter = get_documenter(obj)(self, real_name)
+             if not documenter.parse_name():
+                 self.warn('failed to parse name %s' % real_name)
+                 items.append((display_name, '', '', real_name))
+@@ -380,8 +388,7 @@
+                 prefixed_name = '.'.join([prefix, name])
+             else:
+                 prefixed_name = name
+-            obj, parent = _import_by_name(prefixed_name)
+-            return prefixed_name, obj, parent
++            return _import_by_name(prefixed_name), prefixed_name
+         except ImportError:
+             tried.append(prefixed_name)
+     raise ImportError('no module named %s' % ' or '.join(tried))
+@@ -396,8 +403,7 @@
+         if modname:
+             try:
+                 __import__(modname)
+-                mod = sys.modules[modname]
+-                return getattr(mod, name_parts[-1]), mod
++                return getattr(sys.modules[modname], name_parts[-1])
+             except (ImportError, IndexError, AttributeError):
+                 pass
+ 
+@@ -415,14 +421,12 @@
+                 break
+ 
+         if last_j < len(name_parts):
+-            parent = None
+             obj = sys.modules[modname]
+             for obj_name in name_parts[last_j:]:
+-                parent = obj
+                 obj = getattr(obj, obj_name)
+-            return obj, parent
++            return obj
+         else:
+-            return sys.modules[modname], None
++            return sys.modules[modname]
+     except (ValueError, ImportError, AttributeError, KeyError), e:
+         raise ImportError(*e.args)
+ 
+@@ -445,7 +449,7 @@
+     prefixes = [None]
+     #prefixes.insert(0, inliner.document.settings.env.currmodule)
+     try:
+-        name, obj, parent = import_by_name(pnode['reftarget'], prefixes)
++        obj, name = import_by_name(pnode['reftarget'], prefixes)
+     except ImportError:
+         content = pnode[0]
+         r[0][0] = nodes.emphasis(rawtext, content[0].astext(),
+--- a/sphinx/ext/autosummary/generate.py
++++ b/sphinx/ext/autosummary/generate.py
+@@ -107,7 +107,7 @@
+         ensuredir(path)
+ 
+         try:
+-            name, obj, parent = import_by_name(name)
++            obj, name = import_by_name(name)
+         except ImportError, e:
+             warn('[autosummary] failed to import %r: %s' % (name, e))
+             continue
+@@ -123,7 +123,7 @@
+         f = open(fn, 'w')
+ 
+         try:
+-            doc = get_documenter(obj, parent)
++            doc = get_documenter(obj)
+ 
+             if template_name is not None:
+                 template = template_env.get_template(template_name)
+@@ -137,7 +137,7 @@
+             def get_members(obj, typ, include_public=[]):
+                 items = [
+                     name for name in dir(obj)
+-                    if get_documenter(getattr(obj, name), obj).objtype == typ
++                    if get_documenter(getattr(obj, name)).objtype == typ
+                 ]
+                 public = [x for x in items
+                           if x in include_public or not x.startswith('_')]
+@@ -211,7 +211,7 @@
+     See `find_autosummary_in_lines`.
+     """
+     try:
+-        real_name, obj, parent = import_by_name(name)
++        obj, real_name = import_by_name(name)
+         lines = pydoc.getdoc(obj).splitlines()
+         return find_autosummary_in_lines(lines, module=name, filename=filename)
+     except AttributeError:

Modified: packages/sphinx/branches/1.0/debian/patches/series
===================================================================
--- packages/sphinx/branches/1.0/debian/patches/series	2011-02-17 11:10:25 UTC (rev 15744)
+++ packages/sphinx/branches/1.0/debian/patches/series	2011-02-17 14:26:20 UTC (rev 15745)
@@ -1,2 +1,3 @@
+autosummary_1.0.6.patch
 move_static_files_outside_site-packages.patch
 unversioned_grammar_pickle.diff




More information about the Python-modules-commits mailing list