forked from pool/python-sphinxcontrib-httpdomain
- Replace missing_force_decode.patch with
49-remove_force_decode.patch (gh#sphinx-contrib/httpdomain#49). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinxcontrib-httpdomain?expand=0&rev=44
This commit is contained in:
99
49-remove_force_decode.patch
Normal file
99
49-remove_force_decode.patch
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
From f120ce8d1c3089f23c8bfee41e59a4f84044c0c4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Florian Masy <florian@ezdev.fr>
|
||||||
|
Date: Thu, 24 Jun 2021 21:39:16 +0200
|
||||||
|
Subject: [PATCH] Remove imports and calls to depracated function force_decode
|
||||||
|
who was removed starting with sphinx 4.0
|
||||||
|
|
||||||
|
---
|
||||||
|
sphinxcontrib/autohttp/bottle.py | 6 ++----
|
||||||
|
sphinxcontrib/autohttp/flask.py | 1 -
|
||||||
|
sphinxcontrib/autohttp/flask_base.py | 4 ----
|
||||||
|
sphinxcontrib/autohttp/tornado.py | 6 ++----
|
||||||
|
4 files changed, 4 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sphinxcontrib/autohttp/bottle.py b/sphinxcontrib/autohttp/bottle.py
|
||||||
|
index d249b30..1e8d709 100644
|
||||||
|
--- a/sphinxcontrib/autohttp/bottle.py
|
||||||
|
+++ b/sphinxcontrib/autohttp/bottle.py
|
||||||
|
@@ -17,7 +17,6 @@
|
||||||
|
from docutils.parsers.rst import directives, Directive
|
||||||
|
from docutils.statemachine import ViewList
|
||||||
|
|
||||||
|
-from sphinx.util import force_decode
|
||||||
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
from sphinx.util.docstrings import prepare_docstring
|
||||||
|
from sphinx.pycode import ModuleAnalyzer
|
||||||
|
@@ -89,11 +88,10 @@ def make_rst(self):
|
||||||
|
continue
|
||||||
|
view = target.callback
|
||||||
|
docstring = view.__doc__ or ''
|
||||||
|
- if not isinstance(docstring, six.text_type):
|
||||||
|
- analyzer = ModuleAnalyzer.for_module(view.__module__)
|
||||||
|
- docstring = force_decode(docstring, analyzer.encoding)
|
||||||
|
+
|
||||||
|
if not docstring and 'include-empty-docstring' not in self.options:
|
||||||
|
continue
|
||||||
|
+
|
||||||
|
docstring = prepare_docstring(docstring)
|
||||||
|
for line in http_directive(method, path, docstring):
|
||||||
|
yield line
|
||||||
|
diff --git a/sphinxcontrib/autohttp/flask.py b/sphinxcontrib/autohttp/flask.py
|
||||||
|
index de60c55..761efec 100644
|
||||||
|
--- a/sphinxcontrib/autohttp/flask.py
|
||||||
|
+++ b/sphinxcontrib/autohttp/flask.py
|
||||||
|
@@ -19,7 +19,6 @@
|
||||||
|
from docutils.parsers.rst import directives, Directive
|
||||||
|
from docutils.statemachine import ViewList
|
||||||
|
|
||||||
|
-from sphinx.util import force_decode
|
||||||
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
from sphinx.util.docstrings import prepare_docstring
|
||||||
|
from sphinx.pycode import ModuleAnalyzer
|
||||||
|
diff --git a/sphinxcontrib/autohttp/flask_base.py b/sphinxcontrib/autohttp/flask_base.py
|
||||||
|
index 782a95d..ba3e7ef 100644
|
||||||
|
--- a/sphinxcontrib/autohttp/flask_base.py
|
||||||
|
+++ b/sphinxcontrib/autohttp/flask_base.py
|
||||||
|
@@ -17,7 +17,6 @@
|
||||||
|
|
||||||
|
from docutils.parsers.rst import directives, Directive
|
||||||
|
|
||||||
|
-from sphinx.util import force_decode
|
||||||
|
from sphinx.util.docstrings import prepare_docstring
|
||||||
|
from sphinx.pycode import ModuleAnalyzer
|
||||||
|
|
||||||
|
@@ -236,9 +235,6 @@ def inspect_routes(self, app):
|
||||||
|
if view_func and view_func.__doc__:
|
||||||
|
view_doc = view_func.__doc__
|
||||||
|
|
||||||
|
- if not isinstance(view_doc, six.text_type):
|
||||||
|
- analyzer = ModuleAnalyzer.for_module(view.__module__)
|
||||||
|
- view_doc = force_decode(view_doc, analyzer.encoding)
|
||||||
|
|
||||||
|
if not view_doc and 'include-empty-docstring' not in self.options:
|
||||||
|
continue
|
||||||
|
diff --git a/sphinxcontrib/autohttp/tornado.py b/sphinxcontrib/autohttp/tornado.py
|
||||||
|
index 9a38b10..1e529ef 100644
|
||||||
|
--- a/sphinxcontrib/autohttp/tornado.py
|
||||||
|
+++ b/sphinxcontrib/autohttp/tornado.py
|
||||||
|
@@ -18,7 +18,6 @@
|
||||||
|
from docutils.parsers.rst import directives, Directive
|
||||||
|
from docutils.statemachine import ViewList
|
||||||
|
|
||||||
|
-from sphinx.util import force_decode
|
||||||
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
from sphinx.util.docstrings import prepare_docstring
|
||||||
|
from sphinx.pycode import ModuleAnalyzer
|
||||||
|
@@ -129,11 +128,10 @@ def make_rst(self):
|
||||||
|
continue
|
||||||
|
|
||||||
|
docstring = getattr(handler, method).__doc__ or ''
|
||||||
|
- #if not isinstance(docstring, unicode):
|
||||||
|
- # analyzer = ModuleAnalyzer.for_module(view.__module__)
|
||||||
|
- # docstring = force_decode(docstring, analyzer.encoding)
|
||||||
|
+
|
||||||
|
if not docstring and 'include-empty-docstring' not in self.options:
|
||||||
|
continue
|
||||||
|
+
|
||||||
|
docstring = prepare_docstring(docstring)
|
||||||
|
for line in http_directive(method, normalize_path(path), docstring):
|
||||||
|
yield line
|
@@ -1,89 +0,0 @@
|
|||||||
---
|
|
||||||
sphinxcontrib/autohttp/__init__.py | 19 +++++++++++++++++++
|
|
||||||
sphinxcontrib/autohttp/bottle.py | 5 ++++-
|
|
||||||
sphinxcontrib/autohttp/flask.py | 5 ++++-
|
|
||||||
sphinxcontrib/autohttp/flask_base.py | 5 ++++-
|
|
||||||
sphinxcontrib/autohttp/tornado.py | 5 ++++-
|
|
||||||
5 files changed, 35 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
--- a/sphinxcontrib/autohttp/__init__.py
|
|
||||||
+++ b/sphinxcontrib/autohttp/__init__.py
|
|
||||||
@@ -9,3 +9,22 @@
|
|
||||||
:license: BSD, see LICENSE for details.
|
|
||||||
|
|
||||||
"""
|
|
||||||
+
|
|
||||||
+# Taken from gh#sphinx-doc/sphinx#9326
|
|
||||||
+def force_decode(string: str, encoding: str) -> str:
|
|
||||||
+ """Forcibly get a unicode string out of a bytestring."""
|
|
||||||
+ warnings.warn('force_decode() is deprecated.',
|
|
||||||
+ RemovedInSphinx50Warning, stacklevel=2)
|
|
||||||
+ if isinstance(string, bytes):
|
|
||||||
+ try:
|
|
||||||
+ if encoding:
|
|
||||||
+ string = string.decode(encoding)
|
|
||||||
+ else:
|
|
||||||
+ # try decoding with utf-8, should only work for real UTF-8
|
|
||||||
+ string = string.decode()
|
|
||||||
+ except UnicodeError:
|
|
||||||
+ # last resort -- can't fail
|
|
||||||
+ string = string.decode('latin1')
|
|
||||||
+ return string
|
|
||||||
+
|
|
||||||
+
|
|
||||||
--- a/sphinxcontrib/autohttp/bottle.py
|
|
||||||
+++ b/sphinxcontrib/autohttp/bottle.py
|
|
||||||
@@ -17,7 +17,10 @@ from docutils import nodes
|
|
||||||
from docutils.parsers.rst import directives, Directive
|
|
||||||
from docutils.statemachine import ViewList
|
|
||||||
|
|
||||||
-from sphinx.util import force_decode
|
|
||||||
+try:
|
|
||||||
+ from sphinx.util import force_decode
|
|
||||||
+except ImportError:
|
|
||||||
+ from . import force_decode
|
|
||||||
from sphinx.util.nodes import nested_parse_with_titles
|
|
||||||
from sphinx.util.docstrings import prepare_docstring
|
|
||||||
from sphinx.pycode import ModuleAnalyzer
|
|
||||||
--- a/sphinxcontrib/autohttp/flask.py
|
|
||||||
+++ b/sphinxcontrib/autohttp/flask.py
|
|
||||||
@@ -19,7 +19,10 @@ from docutils import nodes
|
|
||||||
from docutils.parsers.rst import directives, Directive
|
|
||||||
from docutils.statemachine import ViewList
|
|
||||||
|
|
||||||
-from sphinx.util import force_decode
|
|
||||||
+try:
|
|
||||||
+ from sphinx.util import force_decode
|
|
||||||
+except ImportError:
|
|
||||||
+ from . import force_decode
|
|
||||||
from sphinx.util.nodes import nested_parse_with_titles
|
|
||||||
from sphinx.util.docstrings import prepare_docstring
|
|
||||||
from sphinx.pycode import ModuleAnalyzer
|
|
||||||
--- a/sphinxcontrib/autohttp/flask_base.py
|
|
||||||
+++ b/sphinxcontrib/autohttp/flask_base.py
|
|
||||||
@@ -17,7 +17,10 @@ import collections
|
|
||||||
|
|
||||||
from docutils.parsers.rst import directives, Directive
|
|
||||||
|
|
||||||
-from sphinx.util import force_decode
|
|
||||||
+try:
|
|
||||||
+ from sphinx.util import force_decode
|
|
||||||
+except ImportError:
|
|
||||||
+ from . import force_decode
|
|
||||||
from sphinx.util.docstrings import prepare_docstring
|
|
||||||
from sphinx.pycode import ModuleAnalyzer
|
|
||||||
|
|
||||||
--- a/sphinxcontrib/autohttp/tornado.py
|
|
||||||
+++ b/sphinxcontrib/autohttp/tornado.py
|
|
||||||
@@ -18,7 +18,10 @@ from docutils import nodes
|
|
||||||
from docutils.parsers.rst import directives, Directive
|
|
||||||
from docutils.statemachine import ViewList
|
|
||||||
|
|
||||||
-from sphinx.util import force_decode
|
|
||||||
+try:
|
|
||||||
+ from sphinx.util import force_decode
|
|
||||||
+except ImportError:
|
|
||||||
+ from . import force_decode
|
|
||||||
from sphinx.util.nodes import nested_parse_with_titles
|
|
||||||
from sphinx.util.docstrings import prepare_docstring
|
|
||||||
from sphinx.pycode import ModuleAnalyzer
|
|
@@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 19 13:56:40 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Replace missing_force_decode.patch with
|
||||||
|
49-remove_force_decode.patch (gh#sphinx-contrib/httpdomain#49).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jul 9 19:26:19 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
Fri Jul 9 19:26:19 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
@@ -25,9 +25,9 @@ Summary: Sphinx domain for HTTP APIs
|
|||||||
License: BSD-2-Clause
|
License: BSD-2-Clause
|
||||||
URL: https://github.com/sphinx-contrib/httpdomain
|
URL: https://github.com/sphinx-contrib/httpdomain
|
||||||
Source: https://github.com/sphinx-contrib/httpdomain/archive/%{version}.tar.gz
|
Source: https://github.com/sphinx-contrib/httpdomain/archive/%{version}.tar.gz
|
||||||
# PATCH-FIX-UPSTREAM missing_force_decode.patch gh#sphinx-contrib/httpdomain#46 mcepl@suse.com
|
# PATCH-FIX-UPSTREAM 49-remove_force_decode.patch gh#sphinx-contrib/httpdomain#49 mcepl@suse.com
|
||||||
# Add missing force_decode function in case it is missing in the actual Sphinx
|
# Finally remove use of force_decode function (removed from Sphinx).
|
||||||
Patch0: missing_force_decode.patch
|
Patch0: 49-remove_force_decode.patch
|
||||||
BuildRequires: %{python_module Flask >= 0.11}
|
BuildRequires: %{python_module Flask >= 0.11}
|
||||||
BuildRequires: %{python_module Sphinx >= 1.5}
|
BuildRequires: %{python_module Sphinx >= 1.5}
|
||||||
BuildRequires: %{python_module bottle >= 0.11.0}
|
BuildRequires: %{python_module bottle >= 0.11.0}
|
||||||
|
Reference in New Issue
Block a user