From 22ec98a26f91965aa9066dfd2acf84c9fac4fe4664049361834dffd47095a98f Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Mon, 3 Apr 2017 05:06:58 +0000 Subject: [PATCH] - Add 0001-Initialize-sphinx-config-using-application-instead-o.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pbr?expand=0&rev=65 --- ...x-config-using-application-instead-o.patch | 101 ++++++++++++++++++ python-pbr.changes | 5 + python-pbr.spec | 3 + 3 files changed, 109 insertions(+) create mode 100644 0001-Initialize-sphinx-config-using-application-instead-o.patch diff --git a/0001-Initialize-sphinx-config-using-application-instead-o.patch b/0001-Initialize-sphinx-config-using-application-instead-o.patch new file mode 100644 index 0000000..e11b820 --- /dev/null +++ b/0001-Initialize-sphinx-config-using-application-instead-o.patch @@ -0,0 +1,101 @@ +From 2d7c0045f402b31d6223437ba25423eeb32278e1 Mon Sep 17 00:00:00 2001 +From: Alfredo Moralejo +Date: Wed, 22 Mar 2017 04:56:56 -0400 +Subject: [PATCH] Initialize sphinx config using application instead of config + +Currently sphinx config is initialized using sphinx.config, +however in recent versions of Sphinx, plugin specific parameters +as man_pages for man builder has been moved to the extension +and is not initialized from sphinx.config but using sphinx.application. +This is making man_pages to be empty when using sphinx 1.5 and man +builder is not properly called. + +This patch initializes sphinx config using sphinx.application which +works fine with both old and new Sphinx versions. + +Closes-Bug: #1674795 + +Depends-On: I7bde8fc1f2a7db5bd73635aa197377bf5ac614d2 +Change-Id: Ib7c1a6fe8fbb5acfcfcfac61d0b53f080ff2b1e4 +--- + pbr/builddoc.py | 17 ++++------------- + pbr/tests/test_setup.py | 6 +++++- + 2 files changed, 9 insertions(+), 14 deletions(-) + +diff --git a/pbr/builddoc.py b/pbr/builddoc.py +index f51b283..4f05673 100644 +--- a/pbr/builddoc.py ++++ b/pbr/builddoc.py +@@ -17,9 +17,7 @@ + from distutils import log + import fnmatch + import os +-import pkg_resources + import sys +-import warnings + + try: + import cStringIO +@@ -29,7 +27,6 @@ except ImportError: + try: + from sphinx import apidoc + from sphinx import application +- from sphinx import config + from sphinx import setup_command + except Exception as e: + # NOTE(dhellmann): During the installation of docutils, setuptools +@@ -134,16 +131,6 @@ class LocalBuildDoc(setup_command.BuildDoc): + confoverrides['release'] = self.release + if self.today: + confoverrides['today'] = self.today +- sphinx_config = config.Config(self.config_dir, 'conf.py', {}, []) +- sphinx_ver = pkg_resources.parse_version( +- pkg_resources.get_distribution("sphinx").version) +- if sphinx_ver > pkg_resources.parse_version('1.2.3'): +- sphinx_config.init_values(warnings.warn) +- else: +- sphinx_config.init_values() +- if self.builder == 'man' and len( +- getattr(sphinx_config, 'man_pages', '')) == 0: +- return + if self.sphinx_initialized: + confoverrides['suppress_warnings'] = [ + 'app.add_directive', 'app.add_role', +@@ -153,6 +140,10 @@ class LocalBuildDoc(setup_command.BuildDoc): + self.builder_target_dir, self.doctree_dir, + self.builder, confoverrides, status_stream, + freshenv=self.fresh_env, warningiserror=self.warning_is_error) ++ sphinx_config = app.config ++ if self.builder == 'man' and len( ++ getattr(sphinx_config, 'man_pages', '')) == 0: ++ return + self.sphinx_initialized = True + + try: +diff --git a/pbr/tests/test_setup.py b/pbr/tests/test_setup.py +index 0754a8d..0930e35 100644 +--- a/pbr/tests/test_setup.py ++++ b/pbr/tests/test_setup.py +@@ -224,6 +224,10 @@ class GitLogsTest(base.BaseTestCase): + self.assertTrue(co_author in authors) + + ++class _SphinxConfig(object): ++ man_pages = ['foo'] ++ ++ + class BaseSphinxTest(base.BaseTestCase): + + def setUp(self): +@@ -234,7 +238,7 @@ class BaseSphinxTest(base.BaseTestCase): + self.useFixture(fixtures.MonkeyPatch( + "sphinx.application.Sphinx.build", lambda *a, **kw: None)) + self.useFixture(fixtures.MonkeyPatch( +- "sphinx.config.Config.man_pages", ['foo'])) ++ "sphinx.application.Sphinx.config", _SphinxConfig)) + self.useFixture(fixtures.MonkeyPatch( + "sphinx.config.Config.init_values", lambda *a: None)) + self.useFixture(fixtures.MonkeyPatch( +-- +2.12.0 + diff --git a/python-pbr.changes b/python-pbr.changes index d9ba85c..5546dad 100644 --- a/python-pbr.changes +++ b/python-pbr.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Apr 3 05:05:43 UTC 2017 - tbechtold@suse.com + +- Add 0001-Initialize-sphinx-config-using-application-instead-o.patch + ------------------------------------------------------------------- Wed Mar 29 13:53:04 UTC 2017 - jmatejek@suse.com diff --git a/python-pbr.spec b/python-pbr.spec index e801fbc..50a7808 100644 --- a/python-pbr.spec +++ b/python-pbr.spec @@ -30,6 +30,8 @@ Group: Development/Languages/Python Url: http://pypi.python.org/pypi/pbr Source: https://files.pythonhosted.org/packages/source/p/pbr/pbr-%{version}.tar.gz Source1: python-pbr-rpmlintrc +# PATCH-FIX-UPSTREAM 0001-Initialize-sphinx-config-using-application-instead-o.patch~- https://review.openstack.org/#/c/448455/ +Patch1: 0001-Initialize-sphinx-config-using-application-instead-o.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pip >= 1.4} BuildRequires: fdupes @@ -65,6 +67,7 @@ information. %prep %setup -q -n pbr-%{version} +%patch1 -p1 # Get rid of ugly build-time deps that require network: sed -i "s/, 'sphinx\.ext\.intersphinx'//" doc/source/conf.py