[packages/sphinx-pdg] - updated to 1.5.5 - removed obsolete docutils-0.13 patch - added deps patch (don't require mock and

qboosh qboosh at pld-linux.org
Sun Apr 16 21:06:43 CEST 2017


commit 4c3893b4dc12ee4b0e14ccda1d6a80837f29d356
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Apr 16 21:06:51 2017 +0200

    - updated to 1.5.5
    - removed obsolete docutils-0.13 patch
    - added deps patch (don't require mock and simplejson when not really required)
    - added tests patch (skip python3.5+ patch when running with python 2)
    - added mock patch (use unittest.mock instead of external module under python 3)
    - added tests bcond

 docutils-0.13.patch    |  29 ------------
 float-ver.patch        |  12 ++---
 sphinx-pdg-deps.patch  |  11 +++++
 sphinx-pdg-mock.patch  | 126 +++++++++++++++++++++++++++++++++++++++++++++++++
 sphinx-pdg-tests.patch |  18 +++++++
 sphinx-pdg.spec        |  67 +++++++++++++++++++++++---
 6 files changed, 221 insertions(+), 42 deletions(-)
---
diff --git a/sphinx-pdg.spec b/sphinx-pdg.spec
index 55b3421..c6c74c7 100644
--- a/sphinx-pdg.spec
+++ b/sphinx-pdg.spec
@@ -6,25 +6,45 @@
 %bcond_without	python2		# CPython 2.x version
 %bcond_without	python3		# CPython 3.x version
 %bcond_without	python3_default	# Use Python 3.x for easy_install executable
+%bcond_without	tests		# unit tests
 
 Summary:	Sphinx - Python documentation generator
 Summary(pl.UTF-8):	Sphinx - narzędzie do tworzenia dokumentacji dla Pythona
 Name:		sphinx-pdg
-Version:	1.4.1
-Release:	3
+Version:	1.5.5
+Release:	1
 License:	BSD
 Group:		Development/Languages/Python
-#Source0Download: https://pypi.python.org/simple/Sphinx
-Source0:	https://pypi.python.org/packages/61/14/1b1edb28bebde124c455e4dea9cd70685ad8dd2f6baa1a8effe665ebeb23/Sphinx-%{version}.tar.gz
-# Source0-md5:	4c4988e0306a04cef8dccc384281e585
+#Source0Download: https://pypi.python.org/simple/Sphinx/
+Source0:	https://pypi.python.org/packages/64/78/9d63754981e97c8e7cf14500d262fc573145624d4c765d5047f58e3fdf4e/Sphinx-%{version}.tar.gz
+# Source0-md5:	f9581b3556df9722143c47290273bcf8
 Patch0:		float-ver.patch
-Patch1:		docutils-0.13.patch
+Patch1:		%{name}-deps.patch
+Patch2:		%{name}-tests.patch
+Patch3:		%{name}-mock.patch
 URL:		http://sphinx.pocoo.org/
+%if %{with tests} && %(locale -a | grep -q '^C\.UTF-8$'; echo $?)
+BuildRequires:	glibc-localedb-all
+%endif
 %if %{with python2}
 BuildRequires:	python-babel >= 1.3
 BuildRequires:	python-devel >= 1:2.5
 BuildRequires:	python-modules >= 1:2.5
 BuildRequires:	python-setuptools >= 7.0
+%if %{with tests}
+BuildRequires:	python-alabaster >= 0.7
+BuildRequires:	python-alabaster < 0.8
+BuildRequires:	python-docutils >= 0.11
+BuildRequires:	python-html5lib
+BuildRequires:	python-imagesize
+BuildRequires:	python-jinja2 >= 2.3
+BuildRequires:	python-mock
+BuildRequires:	python-pygments >= 2.0
+BuildRequires:	python-pytest >= 3.0
+BuildRequires:	python-requests >= 2.0.0
+BuildRequires:	python-six >= 1.5
+BuildRequires:	python-snowballstemmer >= 1.1
+%endif
 %endif
 %if %{with python3}
 BuildRequires:	python3-2to3
@@ -32,9 +52,27 @@ BuildRequires:	python3-babel >= 1.3
 BuildRequires:	python3-devel
 BuildRequires:	python3-modules
 BuildRequires:	python3-setuptools >= 7.0
+%if %{with tests}
+BuildRequires:	python3-alabaster >= 0.7
+BuildRequires:	python3-alabaster < 0.8
+BuildRequires:	python3-docutils >= 0.11
+BuildRequires:	python3-html5lib
+BuildRequires:	python3-imagesize
+BuildRequires:	python3-jinja2 >= 2.3
+BuildRequires:	python3-pygments >= 2.0
+BuildRequires:	python3-pytest >= 3.0
+BuildRequires:	python3-requests >= 2.0.0
+BuildRequires:	python3-six >= 1.5
+BuildRequires:	python3-snowballstemmer >= 1.1
+%endif
 %endif
 BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.710
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with tests}
+# for test_build_latex.py (disabled now)
+#BuildRequires:	texlive-luatex
+#BuildRequires:	texlive-xetex
+%endif
 %if %{with python3_default}
 Requires:	sphinx-pdg-3 = %{version}-%{release}
 %else
@@ -146,16 +184,31 @@ sphinx-pdg-3.
 %setup -q -n Sphinx-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+# needs python-babel with at least de,en,ja locales installed
+%{__rm} tests/test_util_i18n.py
+# requires various latex variants, fails in a ways difficult to diagnose
+%{__rm} tests/test_build_latex.py
 
 %build
 %if %{with python2}
 %py_build
 %{__rm} sphinx/__init__.pyc
+
+%if %{with tests}
+LC_ALL=C.UTF-8 %{__python} tests/run.py
+%endif
 %endif
 
 %if %{with python3}
 %py3_build
 %{__rm} -r sphinx/__pycache__
+
+%if %{with tests}
+LC_ALL=C.UTF-8 %{__python3} tests/run.py
+%endif
 %endif
 
 %install
diff --git a/docutils-0.13.patch b/docutils-0.13.patch
deleted file mode 100644
index 44c3589..0000000
--- a/docutils-0.13.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
-index af8b6d9..07d16f8 100644
---- a/sphinx/writers/html.py
-+++ b/sphinx/writers/html.py
-@@ -16,6 +16,7 @@
- import warnings
- 
- from six import string_types
-+import docutils
- from docutils import nodes
- from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator
- 
-@@ -532,6 +533,16 @@ def visit_image(self, node):
-                         node['height'] = str(size[1])
-         BaseTranslator.visit_image(self, node)
- 
-+    # overwritten
-+    def depart_image(self, node):
-+        if tuple(map(int, docutils.__version__.split('.'))) >= (0, 13):
-+            # since docutils-0.13, HTMLWriter does not push context data on visit_image()
-+            if node['uri'].lower().endswith(('svg', 'svgz')):
-+                self.body.append(self.context.pop())
-+        else:
-+            # docutils-0.12 or below, HTML Writer always push context data on visit_image()
-+            self.body.append(self.context.pop())
-+
-     def visit_toctree(self, node):
-         # this only happens when formatting a toc from env.tocs -- in this
-         # case we don't want to include the subtree
diff --git a/float-ver.patch b/float-ver.patch
index 7089d03..e8bc18b 100644
--- a/float-ver.patch
+++ b/float-ver.patch
@@ -1,11 +1,11 @@
---- Sphinx-1.4.1/sphinx/application.py.orig	2016-05-12 20:44:55.230010066 +0200
-+++ Sphinx-1.4.1/sphinx/application.py	2016-05-12 20:47:26.036670440 +0200
-@@ -165,7 +165,7 @@
+--- Sphinx-1.5.3/sphinx/application.py.orig	2017-03-05 07:46:30.349734431 +0100
++++ Sphinx-1.5.3/sphinx/application.py	2017-03-05 08:33:32.339702213 +0100
+@@ -168,7 +168,7 @@
+         self.config.pre_init_values(self.warn)
  
          # check the Sphinx version if requested
-         if self.config.needs_sphinx and \
--           self.config.needs_sphinx > sphinx.__display_version__:
-+           str(self.config.needs_sphinx) > sphinx.__display_version__:
+-        if self.config.needs_sphinx and self.config.needs_sphinx > sphinx.__display_version__:
++        if self.config.needs_sphinx and str(self.config.needs_sphinx) > sphinx.__display_version__:
              raise VersionRequirementError(
                  'This project needs at least Sphinx v%s and therefore cannot '
                  'be built with this version.' % self.config.needs_sphinx)
diff --git a/sphinx-pdg-deps.patch b/sphinx-pdg-deps.patch
new file mode 100644
index 0000000..84d0518
--- /dev/null
+++ b/sphinx-pdg-deps.patch
@@ -0,0 +1,11 @@
+--- Sphinx-1.5.5/setup.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/setup.py	2017-04-09 11:50:42.216134320 +0200
+@@ -63,8 +63,6 @@
+     ],
+     'test': [
+         'pytest',
+-        'mock',  # it would be better for 'test:python_version in 2.7'
+-        'simplejson',  # better: 'test:platform_python_implementation=="PyPy"'
+         'html5lib',
+     ],
+ }
diff --git a/sphinx-pdg-mock.patch b/sphinx-pdg-mock.patch
new file mode 100644
index 0000000..50c74dd
--- /dev/null
+++ b/sphinx-pdg-mock.patch
@@ -0,0 +1,126 @@
+--- Sphinx-1.5.5/tests/test_build.py.orig	2017-03-28 03:53:51.000000000 +0200
++++ Sphinx-1.5.5/tests/test_build.py	2017-04-16 19:16:14.272256683 +0200
+@@ -11,7 +11,10 @@
+ 
+ import pickle
+ from docutils import nodes
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import pytest
+ from textwrap import dedent
+ from sphinx.errors import SphinxError
+--- Sphinx-1.5.5/tests/test_config.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/tests/test_config.py	2017-04-16 19:16:22.865589918 +0200
+@@ -11,7 +11,10 @@
+ """
+ from six import PY3, iteritems
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ import sphinx
+ from sphinx.config import Config
+--- Sphinx-1.5.5/tests/test_domain_std.py.orig	2017-03-27 03:42:15.000000000 +0200
++++ Sphinx-1.5.5/tests/test_domain_std.py	2017-04-16 19:16:28.592256519 +0200
+@@ -10,7 +10,10 @@
+ """
+ 
+ from docutils import nodes
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from sphinx.domains.std import StandardDomain
+ 
+--- Sphinx-1.5.5/tests/test_environment_indexentries.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/tests/test_environment_indexentries.py	2017-04-16 19:16:37.202256421 +0200
+@@ -13,7 +13,10 @@ from collections import namedtuple
+ from sphinx import locale
+ from sphinx.environment.managers.indexentries import IndexEntries
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ Environment = namedtuple('Environment', 'indexentries')
+ 
+--- Sphinx-1.5.5/tests/test_ext_intersphinx.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/tests/test_ext_intersphinx.py	2017-04-16 19:16:44.515589673 +0200
+@@ -15,7 +15,10 @@ import zlib
+ 
+ from six import BytesIO
+ from docutils import nodes
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import pytest
+ import requests
+ from io import BytesIO
+--- Sphinx-1.5.5/tests/test_ext_napoleon_docstring.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/tests/test_ext_napoleon_docstring.py	2017-04-16 19:16:54.252256226 +0200
+@@ -19,7 +19,10 @@ from unittest import TestCase
+ 
+ from sphinx.ext.napoleon import Config
+ from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ 
+ class NamedtupleSubclass(namedtuple('NamedtupleSubclass', ('attr1', 'attr2'))):
+--- Sphinx-1.5.5/tests/test_ext_napoleon.py.orig	2017-03-27 03:42:15.000000000 +0200
++++ Sphinx-1.5.5/tests/test_ext_napoleon.py	2017-04-16 19:17:01.395589480 +0200
+@@ -16,7 +16,10 @@ from unittest import TestCase
+ from sphinx.application import Sphinx
+ from sphinx.ext.napoleon import (_process_docstring, _skip_member, Config,
+                                  setup)
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ 
+ def _private_doc():
+--- Sphinx-1.5.5/tests/test_theming.py.orig	2017-03-27 03:42:15.000000000 +0200
++++ Sphinx-1.5.5/tests/test_theming.py	2017-04-16 19:17:07.258922745 +0200
+@@ -12,7 +12,10 @@
+ import os
+ import zipfile
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import pytest
+ 
+ from sphinx.theming import Theme, ThemeError
+--- Sphinx-1.5.5/tests/test_util_fileutil.py.orig	2017-03-27 03:42:15.000000000 +0200
++++ Sphinx-1.5.5/tests/test_util_fileutil.py	2017-04-16 19:17:19.555589270 +0200
+@@ -11,7 +11,10 @@
+ from sphinx.util.fileutil import copy_asset, copy_asset_file
+ from sphinx.jinja2glue import BuiltinTemplateLoader
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ 
+ class DummyTemplateLoader(BuiltinTemplateLoader):
diff --git a/sphinx-pdg-tests.patch b/sphinx-pdg-tests.patch
new file mode 100644
index 0000000..e3cd6b8
--- /dev/null
+++ b/sphinx-pdg-tests.patch
@@ -0,0 +1,18 @@
+--- Sphinx-1.5.5/tests/run.py.orig	2017-04-03 17:17:12.000000000 +0200
++++ Sphinx-1.5.5/tests/run.py	2017-04-12 17:43:14.379599864 +0200
+@@ -54,10 +54,14 @@
+ sys.stdout.flush()
+ 
+ # exclude 'root' and 'roots' dirs for pytest test collector
++ignore_subdirs = ['root', 'roots']
++if sys.version_info[:2] < (3, 5):
++    ignore_subdirs.append('py35')
+ ignore_paths = [
+     os.path.relpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), sub))
+-    for sub in ('root', 'roots')
++    for sub in ignore_subdirs
+ ]
++
+ args = sys.argv[1:]
+ for ignore_path in ignore_paths:
+     args.extend(['--ignore', ignore_path])
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/sphinx-pdg.git/commitdiff/4c3893b4dc12ee4b0e14ccda1d6a80837f29d356



More information about the pld-cvs-commit mailing list