diff --git a/newer-sphinx.patch b/newer-sphinx.patch new file mode 100644 index 0000000..11d1a37 --- /dev/null +++ b/newer-sphinx.patch @@ -0,0 +1,206 @@ +# HG changeset patch +# User Dave Shawley +# Date 1498216338 14400 +# Fri Jun 23 07:12:18 2017 -0400 +# Branch new-sphinx +# Node ID ac9095c543a4c5ffba77da14ca21aaa155725418 +# Parent e758073384efd1ed5ed1e6286301b7bef71b27cf +Update 'http' domain detection to work with new Sphinx. + +The autohttp.*.setup functions were detecting whether httpdomain was +installed using an attribute on the sphinx application that was removed +in recent Sphinx versions. This commit: + +(1) moves the idempotency logic into httpdomain.setup +(2) makes the logic work with new and old versions of sphinx by + falling back to the legacy behavior on AttributeError +(3) changes each setup function to always call the new idempotent + httpdomain.setup + +diff -r e758073384ef -r ac9095c543a4 httpdomain/sphinxcontrib/autohttp/bottle.py +--- a/sphinxcontrib/autohttp/bottle.py Fri Mar 31 17:37:43 2017 +0000 ++++ b/sphinxcontrib/autohttp/bottle.py Fri Jun 23 07:12:18 2017 -0400 +@@ -108,7 +108,6 @@ + + + def setup(app): +- if 'http' not in app.domains: +- httpdomain.setup(app) ++ httpdomain.setup(app) + app.add_directive('autobottle', AutobottleDirective) + +diff -r e758073384ef -r ac9095c543a4 httpdomain/sphinxcontrib/autohttp/flask.py +--- a/sphinxcontrib/autohttp/flask.py Fri Mar 31 17:37:43 2017 +0000 ++++ b/sphinxcontrib/autohttp/flask.py Fri Jun 23 07:12:18 2017 -0400 +@@ -43,6 +43,5 @@ + + + def setup(app): +- if 'http' not in app.domains: +- httpdomain.setup(app) ++ httpdomain.setup(app) + app.add_directive('autoflask', AutoflaskDirective) +diff -r e758073384ef -r ac9095c543a4 httpdomain/sphinxcontrib/autohttp/flaskqref.py +--- a/sphinxcontrib/autohttp/flaskqref.py Fri Mar 31 17:37:43 2017 +0000 ++++ b/sphinxcontrib/autohttp/flaskqref.py Fri Jun 23 07:12:18 2017 -0400 +@@ -2,7 +2,7 @@ + sphinxcontrib.autohttp.flaskqref + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- The sphinx.ext.autodoc-style HTTP API quick reference ++ The sphinx.ext.autodoc-style HTTP API quick reference + builder (from Flask) + for sphinxcontrib.httpdomain. + +@@ -38,15 +38,15 @@ + node.document = self.state.document + result = ViewList() + for line in QuickReferenceFlaskDirective.header: +- result.append(line, '') ++ result.append(line, '') + table={} + table_sorted_names=[] +- ++ + for table_row in self.make_rst(qref=True): + name = table_row['name'] + if table.get(name) is None: + table[name]=[] +- table[name].append(table_row) ++ table[name].append(table_row) + if name not in table_sorted_names: + table_sorted_names.append(name) + +@@ -72,9 +72,8 @@ + result.append('', '') + nested_parse_with_titles(self.state, result, node) + return node.children +- ++ + def setup(app): +- if 'http' not in app.domains: +- httpdomain.setup(app) ++ httpdomain.setup(app) + app.add_directive('qrefflask', QuickReferenceFlaskDirective) + +diff -r e758073384ef -r ac9095c543a4 httpdomain/sphinxcontrib/autohttp/tornado.py +--- a/sphinxcontrib/autohttp/tornado.py Fri Mar 31 17:37:43 2017 +0000 ++++ b/sphinxcontrib/autohttp/tornado.py Fri Jun 23 07:12:18 2017 -0400 +@@ -123,6 +123,5 @@ + + + def setup(app): +- if 'http' not in app.domains: +- httpdomain.setup(app) ++ httpdomain.setup(app) + app.add_directive('autotornado', AutoTornadoDirective) +diff -r e758073384ef -r ac9095c543a4 httpdomain/sphinxcontrib/httpdomain.py +--- a/sphinxcontrib/httpdomain.py Fri Mar 31 17:37:43 2017 +0000 ++++ b/sphinxcontrib/httpdomain.py Fri Jun 23 07:12:18 2017 -0400 +@@ -756,7 +756,13 @@ + + + def setup(app): +- app.add_domain(HTTPDomain) ++ try: ++ if app.registry.has_domain(HTTPDomain.name): ++ return ++ except AttributeError: ++ if HTTPDomain.name in app.domains: ++ return ++ + try: + get_lexer_by_name('http') + except ClassNotFound: +# HG changeset patch +# User Dave Shawley +# Date 1498564881 14400 +# Tue Jun 27 08:01:21 2017 -0400 +# Branch new-sphinx +# Node ID 158f6d8b018b3d148d389df8abb0485d665907f4 +# Parent ac9095c543a4c5ffba77da14ca21aaa155725418 +httpdomain: Add missing call to add_domain. + +diff -r ac9095c543a4 -r 158f6d8b018b httpdomain/sphinxcontrib/httpdomain.py +--- a/sphinxcontrib/httpdomain.py Fri Jun 23 07:12:18 2017 -0400 ++++ b/sphinxcontrib/httpdomain.py Tue Jun 27 08:01:21 2017 -0400 +@@ -763,6 +763,8 @@ + if HTTPDomain.name in app.domains: + return + ++ app.add_domain(HTTPDomain) ++ + try: + get_lexer_by_name('http') + except ClassNotFound: +# HG changeset patch +# User Dave Shawley +# Date 1498565517 14400 +# Tue Jun 27 08:11:57 2017 -0400 +# Branch new-sphinx +# Node ID ec67ec284a091ae31856c65a63004e21af26e6f3 +# Parent 158f6d8b018b3d148d389df8abb0485d665907f4 +httpdomain/autohttp: Use app.setup_extension. + +This method has been available since sphinx 1.0 so there is no need to wrap +this in "version safety" checks and it is significantly cleaner. + +diff -r 158f6d8b018b -r ec67ec284a09 httpdomain/sphinxcontrib/autohttp/bottle.py +--- a/sphinxcontrib/autohttp/bottle.py Tue Jun 27 08:01:21 2017 -0400 ++++ b/sphinxcontrib/autohttp/bottle.py Tue Jun 27 08:11:57 2017 -0400 +@@ -108,6 +108,5 @@ + + + def setup(app): +- httpdomain.setup(app) ++ app.setup_extension('sphinxcontrib.httpdomain') + app.add_directive('autobottle', AutobottleDirective) +- +diff -r 158f6d8b018b -r ec67ec284a09 httpdomain/sphinxcontrib/autohttp/flask.py +--- a/sphinxcontrib/autohttp/flask.py Tue Jun 27 08:01:21 2017 -0400 ++++ b/sphinxcontrib/autohttp/flask.py Tue Jun 27 08:11:57 2017 -0400 +@@ -43,5 +43,5 @@ + + + def setup(app): +- httpdomain.setup(app) ++ app.setup_extension('sphinxcontrib.httpdomain') + app.add_directive('autoflask', AutoflaskDirective) +diff -r 158f6d8b018b -r ec67ec284a09 httpdomain/sphinxcontrib/autohttp/flaskqref.py +--- a/sphinxcontrib/autohttp/flaskqref.py Tue Jun 27 08:01:21 2017 -0400 ++++ b/sphinxcontrib/autohttp/flaskqref.py Tue Jun 27 08:11:57 2017 -0400 +@@ -74,6 +74,5 @@ + return node.children + + def setup(app): +- httpdomain.setup(app) ++ app.setup_extension('sphinxcontrib.httpdomain') + app.add_directive('qrefflask', QuickReferenceFlaskDirective) +- +diff -r 158f6d8b018b -r ec67ec284a09 httpdomain/sphinxcontrib/autohttp/tornado.py +--- a/sphinxcontrib/autohttp/tornado.py Tue Jun 27 08:01:21 2017 -0400 ++++ b/sphinxcontrib/autohttp/tornado.py Tue Jun 27 08:11:57 2017 -0400 +@@ -123,5 +123,5 @@ + + + def setup(app): +- httpdomain.setup(app) ++ app.setup_extension('sphinxcontrib.httpdomain') + app.add_directive('autotornado', AutoTornadoDirective) +diff -r 158f6d8b018b -r ec67ec284a09 httpdomain/sphinxcontrib/httpdomain.py +--- a/sphinxcontrib/httpdomain.py Tue Jun 27 08:01:21 2017 -0400 ++++ b/sphinxcontrib/httpdomain.py Tue Jun 27 08:11:57 2017 -0400 +@@ -756,13 +756,6 @@ + + + def setup(app): +- try: +- if app.registry.has_domain(HTTPDomain.name): +- return +- except AttributeError: +- if HTTPDomain.name in app.domains: +- return +- + app.add_domain(HTTPDomain) + + try: diff --git a/python-sphinxcontrib-httpdomain.changes b/python-sphinxcontrib-httpdomain.changes index 2b7990e..d21b708 100644 --- a/python-sphinxcontrib-httpdomain.changes +++ b/python-sphinxcontrib-httpdomain.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Wed Jul 5 07:44:42 UTC 2017 - tbechtold@suse.com + +- add newer-sphinx.patch. Needed to make httpdomain working with + Sphinx >= 1.6 . + +------------------------------------------------------------------- +Wed Jul 5 07:32:16 UTC 2017 - tbechtold@suse.com + +- convert to singlespec + ------------------------------------------------------------------- Mon Nov 14 14:20:01 UTC 2016 - dmueller@suse.com diff --git a/python-sphinxcontrib-httpdomain.spec b/python-sphinxcontrib-httpdomain.spec index 009691f..e722317 100644 --- a/python-sphinxcontrib-httpdomain.spec +++ b/python-sphinxcontrib-httpdomain.spec @@ -1,7 +1,7 @@ # # spec file for package python-sphinxcontrib-httpdomain # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,6 +16,7 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-sphinxcontrib-httpdomain Version: 1.5.0 Release: 0 @@ -24,16 +25,17 @@ License: BSD-2-Clause Group: Development/Languages/Python Url: http://bitbucket.org/birkenfeld/sphinx-contrib Source: https://pypi.io/packages/source/s/sphinxcontrib-httpdomain/sphinxcontrib-httpdomain-%{version}.tar.gz -BuildRequires: python-devel -BuildRequires: python-setuptools +# PATCH-FIX-UPSTREAM newer-sphinx.patch -- https://bitbucket.org/birkenfeld/sphinx-contrib/pull-requests/152/fix-182-by-moving-around-initialization/diff +Patch1: newer-sphinx.patch +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros Requires: python-Sphinx Requires: python-six BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else BuildArch: noarch -%endif + +%python_subpackages %description This contrib extension, sphinxcontrib.httpdomain provides a Sphinx @@ -45,14 +47,15 @@ http://packages.python.org/sphinxcontrib-httpdomain/ %prep %setup -q -n sphinxcontrib-httpdomain-%{version} +%patch1 -p1 %build -python setup.py build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install -%files +%files %{python_files} %defattr(-,root,root,-) %doc LICENSE README.rst %{python_sitelib}/*