[Python-modules-team] Bug#876931: psycopg2 FTBFS with Sphinx 1.6: Could not import extension dbapi_extension

Corey Bryant corey.bryant at canonical.com
Tue Nov 21 18:52:30 UTC 2017


Package: psycopg2
Version: 2.7.3-2
Followup-For: Bug #876931
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * d/p/0001-Make-dbapi_extension.py-compatible-with-Sphinx-1.6.patch:
    Cherry-picked from upstream master branch after hitting build failure:
    "Could not import extension dbapi_extension (exception: cannot import
     name 'make_admonition')."


Thanks for considering the patch.


-- System Information:
Debian Release: buster/sid
  APT prefers bionic
  APT policy: (500, 'bionic'), (500, 'artful-updates')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-16-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
diff -u psycopg2-2.7.3/debian/patches/series psycopg2-2.7.3/debian/patches/series
--- psycopg2-2.7.3/debian/patches/series
+++ psycopg2-2.7.3/debian/patches/series
@@ -1,0 +2 @@
+0001-Make-dbapi_extension.py-compatible-with-Sphinx-1.6.patch
only in patch2:
unchanged:
--- psycopg2-2.7.3.orig/debian/patches/0001-Make-dbapi_extension.py-compatible-with-Sphinx-1.6.patch
+++ psycopg2-2.7.3/debian/patches/0001-Make-dbapi_extension.py-compatible-with-Sphinx-1.6.patch
@@ -0,0 +1,46 @@
+From 1ccb61fe18ddc1fbb498ee90f182c44066aefb36 Mon Sep 17 00:00:00 2001
+From: Dmitry Shachnev <mitya57 at gmail.com>
+Date: Thu, 12 Oct 2017 13:08:24 +0300
+Subject: [PATCH] Make dbapi_extension.py compatible with Sphinx 1.6
+
+In Sphinx commit 1a821b89e9952fc2, the deprecated make_admonition()
+function was removed. This commit updates the code to use the modern
+API instead.
+---
+ doc/src/tools/lib/dbapi_extension.py | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/doc/src/tools/lib/dbapi_extension.py b/doc/src/tools/lib/dbapi_extension.py
+index cb3fec4..7ab656f 100755
+--- a/doc/src/tools/lib/dbapi_extension.py
++++ b/doc/src/tools/lib/dbapi_extension.py
+@@ -12,7 +12,7 @@
+ from docutils import nodes
+ 
+ from sphinx.locale import _
+-from sphinx.util.compat import Directive, make_admonition
++from docutils.parsers.rst import Directive
+ 
+ class extension_node(nodes.Admonition, nodes.Element): pass
+ 
+@@ -29,12 +29,11 @@ class Extension(Directive):
+     option_spec = {}
+ 
+     def run(self):
+-        nodes = make_admonition(extension_node,
+-                self.name, [_('DB API extension')], self.options,
+-                self.content, self.lineno, self.content_offset,
+-                self.block_text, self.state, self.state_machine)
+-        nodes[0]['classes'].append('dbapi-extension')
+-        return nodes
++        node = extension_node('\n'.join(self.content))
++        node += nodes.title(_('DB API extension'), _('DB API extension'))
++        self.state.nested_parse(self.content, self.content_offset, node)
++        node['classes'].append('dbapi-extension')
++        return [node]
+ 
+ 
+ def visit_extension_node(self, node):
+-- 
+2.14.1
+


More information about the Python-modules-team mailing list