python3-repoze.sphinx.autointerface: patch for sphinx 3.x.
Close: #23257
This commit is contained in:
parent
d6aea301ee
commit
f766515cad
2 changed files with 63 additions and 2 deletions
|
@ -0,0 +1,60 @@
|
|||
From f1ce0d2f790ebd8e1158ac8e4a1d04715053fc38 Mon Sep 17 00:00:00 2001
|
||||
From: Fred Drake <fred.drake@keepertech.com>
|
||||
Date: Tue, 24 Mar 2020 15:01:46 -0400
|
||||
Subject: [PATCH] update to work with newer sphinx
|
||||
|
||||
- avoid sphinx.util.force_decode on python 3.x
|
||||
- support sphinx 3.x:
|
||||
* Sphinx.domains -> Sphinx.registry.domains
|
||||
* Sphinx.override_domain(D) -> Sphinx.add_domain(D, override=True)
|
||||
---
|
||||
repoze/sphinx/autointerface.py | 26 ++++++++++++++++++++++----
|
||||
|
||||
Modified by fosslinux.
|
||||
|
||||
diff --git repoze/sphinx/autointerface.py repoze/sphinx/autointerface.py
|
||||
index 597567e..147c790 100644
|
||||
--- repoze/sphinx/autointerface.py
|
||||
+++ repoze/sphinx/autointerface.py
|
||||
@@ -1,2 +1,10 @@
|
||||
from zope.interface.interface import InterfaceClass
|
||||
|
||||
+
|
||||
+if sys.version_info < (3,):
|
||||
+ from sphinx.util import force_decode
|
||||
+else:
|
||||
+ def force_decode(s, encoding):
|
||||
+ return s
|
||||
+
|
||||
+
|
||||
@@ -117,17 +117,27 @@
|
||||
|
||||
from sphinx.domains import ObjType
|
||||
|
||||
+ try:
|
||||
+ domains = app.domains
|
||||
+ except AttributeError:
|
||||
+ domains = app.registry.domains
|
||||
+
|
||||
# Allow the :class: directive to xref interface objects through the search
|
||||
# mechanism, i.e., prefixed with a '.', like :class:`.ITheInterface`
|
||||
# (without this, an exact match is required)
|
||||
- class InterfacePythonDomain(app.domains['py']):
|
||||
+ class InterfacePythonDomain(domains['py']):
|
||||
pass
|
||||
- InterfacePythonDomain.object_types = app.domains['py'].object_types.copy()
|
||||
+ InterfacePythonDomain.object_types = domains['py'].object_types.copy()
|
||||
InterfacePythonDomain.object_types['interface'] = ObjType( 'interface', 'interface', 'obj', 'class')
|
||||
old_class = InterfacePythonDomain.object_types['class']
|
||||
new_class = ObjType( old_class.lname, *(old_class.roles + ('interface',)), **old_class.attrs )
|
||||
InterfacePythonDomain.object_types['class'] = new_class
|
||||
- app.override_domain( InterfacePythonDomain )
|
||||
+
|
||||
+ if hasattr(app, 'override_domain'):
|
||||
+ app.override_domain( InterfacePythonDomain )
|
||||
+ else:
|
||||
+ app.add_domain( InterfacePythonDomain, override=True )
|
||||
+
|
||||
except AttributeError:
|
||||
# Sphinx < 1.0
|
||||
app.add_directive('interface', InterfaceDesc)
|
|
@ -1,12 +1,13 @@
|
|||
# Template file for 'python3-repoze.sphinx.autointerface'
|
||||
pkgname=python3-repoze.sphinx.autointerface
|
||||
version=0.8
|
||||
revision=2
|
||||
revision=3
|
||||
archs=noarch
|
||||
wrksrc="repoze.sphinx.autointerface-${version}"
|
||||
build_style=python3-module
|
||||
hostmakedepends="python3-setuptools"
|
||||
depends="python3-zope.interface"
|
||||
depends="python3-zope.interface python3-Sphinx python3-setuptools"
|
||||
checkdepends="$depends"
|
||||
short_desc="Sphinx extension to auto-generate API docs from Zope interfaces"
|
||||
maintainer="Alex Childs <misuchiru03+void@gmail.com>"
|
||||
license="BSD-4-Clause"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue