[packages/python-Sphinx] - resurrected, for old versions supporting python2

qboosh qboosh at pld-linux.org
Thu Apr 2 21:17:49 CEST 2020


commit f5bd08f783e333f793ff9c2df8c1966e82ede914
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Apr 2 21:17:41 2020 +0200

    - resurrected, for old versions supporting python2

 python-Sphinx-float-ver.patch |  11 ++
 python-Sphinx-mock.patch      | 122 ++++++++++++++++
 python-Sphinx.spec            | 332 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 465 insertions(+)
---
diff --git a/python-Sphinx.spec b/python-Sphinx.spec
new file mode 100644
index 0000000..1c28a0a
--- /dev/null
+++ b/python-Sphinx.spec
@@ -0,0 +1,332 @@
+# NOTE: for newer, python3 only versions, see sphinx-pdg.spec
+#
+# Conditional build:
+%bcond_without	python2		# CPython 2.x version
+%bcond_with	python3		# CPython 3.x version
+%bcond_without	doc		# documentation
+%bcond_with	tests		# unit tests (some fail on import of existing module???)
+
+Summary:	Sphinx Python documentation generator (Python 2.x modules)
+Summary(pl.UTF-8):	Sphinx - narzędzie do tworzenia dokumentacji dla Pythona (moduły Pythona 2.x)
+Name:		python-Sphinx
+# note: keep 1.x here, Sphinx 2+ doesn't support Python 2
+Version:	1.8.5
+Release:	1
+License:	BSD
+Group:		Development/Languages/Python
+#Source0Download: https://pypi.org/simple/Sphinx/
+Source0:	https://files.pythonhosted.org/packages/source/S/Sphinx/Sphinx-%{version}.tar.gz
+# Source0-md5:	554f7a4e752f48b2601e5ef5ab463346
+Patch0:		%{name}-float-ver.patch
+Patch1:		%{name}-mock.patch
+URL:		http://www.sphinx-doc.org/
+%if %{with tests} && %(locale -a | grep -q '^C\.utf8$'; echo $?)
+BuildRequires:	glibc-localedb-all
+%endif
+%if %{with python2}
+BuildRequires:	python-babel >= 1.3
+BuildRequires:	python-devel >= 1:2.7
+BuildRequires:	python-modules >= 1:2.7
+BuildRequires:	python-setuptools >= 1:7.0
+%if %{with tests}
+BuildRequires:	python-alabaster >= 0.7
+BuildRequires:	python-alabaster < 0.8
+BuildRequires:	python-docutils >= 0.11
+BuildRequires:	python-enum34
+# for style checks, not run by pytest
+#BuildRequires:	python-flake8 >= 3.5.0
+#BuildRequires:	python-flake8-import-order
+BuildRequires:	python-html5lib
+BuildRequires:	python-imagesize
+BuildRequires:	python-jinja2 >= 2.3
+BuildRequires:	python-mock
+BuildRequires:	python-packaging
+BuildRequires:	python-pygments >= 2.0
+BuildRequires:	python-pytest >= 3.0
+# for coverage tests only
+#BuildRequires:	python-pytest-cov
+BuildRequires:	python-requests >= 2.0.0
+BuildRequires:	python-six >= 1.5
+BuildRequires:	python-snowballstemmer >= 1.1
+BuildRequires:	python-sphinxcontrib-websupport
+BuildRequires:	python-typing
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-babel >= 1.3
+BuildRequires:	python3-devel >= 1:3.4
+BuildRequires:	python3-modules >= 1:3.4
+BuildRequires:	python3-setuptools >= 1:7.0
+%if %{with tests}
+BuildRequires:	python3-alabaster >= 0.7
+BuildRequires:	python3-alabaster < 0.8
+BuildRequires:	python3-docutils >= 0.11
+# for style checks, not run by pytest
+#BuildRequires:	python3-flake8 >= 3.5.0
+#BuildRequires:	python3-flake8-import-order
+BuildRequires:	python3-html5lib
+BuildRequires:	python3-imagesize
+BuildRequires:	python3-jinja2 >= 2.3
+# for type checks only, not run by pytest
+#BuildRequires:	python3-mypy
+BuildRequires:	python3-packaging
+BuildRequires:	python3-pygments >= 2.0
+BuildRequires:	python3-pytest >= 3.0
+# for coverage tests only
+#BuildRequires:	python3-pytest-cov
+BuildRequires:	python3-requests >= 2.0.0
+BuildRequires:	python3-six >= 1.5
+BuildRequires:	python3-snowballstemmer >= 1.1
+BuildRequires:	python3-sphinxcontrib-websupport
+BuildRequires:	python3-typed_ast
+%if "%{py3_ver}" < "3.5"
+BuildRequires:	python3-typing
+%endif
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+BuildRequires:	sed >= 4.0
+%if %{with tests}
+# for test_build_latex.py (disabled now)
+#BuildRequires:	texlive-luatex
+#BuildRequires:	texlive-xetex
+%endif
+Requires:	python-modules >= 1:2.7
+Conflicts:	sphinx-pdg < 1.0.7-2
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Sphinx is a tool that makes it easy to create intelligent and
+beautiful documentation for Python projects (or other documents
+consisting of multiple reStructuredText sources), written by Georg
+Brandl. It was originally created to translate the new Python
+documentation, but has now been cleaned up in the hope that it will be
+useful to many other projects.
+
+This package contains Python 2.x modules. For command-line utilities,
+see sphinx-pdg-2 package.
+
+%description -l pl.UTF-8
+Sphinx to narzędzie ułatwiające tworzenie inteligentnej i ładnej
+dokumentacji dla projektów w Pythonie (lub innych dokumentów
+składających się z wielu źródeł w formacie reStructuredText), napisane
+przez Georga Brandla. Pierwotnie powstało do tłumaczenia nowej
+dokumentacji Pythona, ale potem zostało wyczyszczone w nadziei, że
+będzie przydatne dla wielu innych projektów.
+
+Ten pakiet zawiera moduły Pythona 2.x. Narzędzia działające z linii
+poleceń znajdują się w pakiecie sphinx-pdg-2.
+
+%package -n sphinx-pdg-2
+Summary:	Sphinx Python documentation generator (Python 2 version)
+Summary(pl.UTF-8):	Sphinx - narzędzie do tworzenia dokumentacji dla Pythona (wersja dla Pythona 2)
+Group:		Development/Languages/Python
+Requires:	python-Sphinx = %{version}-%{release}
+Conflicts:	sphinx-pdg < 1.3.2
+
+%description -n sphinx-pdg-2
+Sphinx is a tool that makes it easy to create intelligent and
+beautiful documentation for Python projects (or other documents
+consisting of multiple reStructuredText sources), written by Georg
+Brandl. It was originally created to translate the new Python
+documentation, but has now been cleaned up in the hope that it will be
+useful to many other projects.
+
+%description -n sphinx-pdg-2 -l pl.UTF-8
+Sphinx to narzędzie ułatwiające tworzenie inteligentnej i ładnej
+dokumentacji dla projektów w Pythonie (lub innych dokumentów
+składających się z wielu źródeł w formacie reStructuredText), napisane
+przez Georga Brandla. Pierwotnie powstało do tłumaczenia nowej
+dokumentacji Pythona, ale potem zostało wyczyszczone w nadziei, że
+będzie przydatne dla wielu innych projektów.
+
+%package -n python3-Sphinx
+Summary:	Sphinx Python documentation generator (Python 3.x modules)
+Summary(pl.UTF-8):	Sphinx - narzędzie do tworzenia dokumentacji dla Pythona (moduły Pythona 3.x)
+Group:		Development/Languages/Python
+Requires:	python3-modules >= 1:3.4
+Conflicts:	sphinx-pdg-3 < 1.0.7-2
+
+%description -n python3-Sphinx
+Sphinx is a tool that makes it easy to create intelligent and
+beautiful documentation for Python projects (or other documents
+consisting of multiple reStructuredText sources), written by Georg
+Brandl. It was originally created to translate the new Python
+documentation, but has now been cleaned up in the hope that it will be
+useful to many other projects.
+
+This package contains Python 3.x modules. For command-line utilities,
+see sphinx-pdg-3 package.
+
+%description -n python3-Sphinx -l pl.UTF-8
+Sphinx to narzędzie ułatwiające tworzenie inteligentnej i ładnej
+dokumentacji dla projektów w Pythonie (lub innych dokumentów
+składających się z wielu źródeł w formacie reStructuredText), napisane
+przez Georga Brandla. Pierwotnie powstało do tłumaczenia nowej
+dokumentacji Pythona, ale potem zostało wyczyszczone w nadziei, że
+będzie przydatne dla wielu innych projektów.
+
+Ten pakiet zawiera moduły Pythona 3.x. Narzędzia działające z linii
+poleceń znajdują się w pakiecie sphinx-pdg-3.
+
+%package -n sphinx-pdg-3
+Summary:	Sphinx Python documentation generator (Python 3 version)
+Summary(pl.UTF-8):	Sphinx - narzędzie do tworzenia dokumentacji dla Pythona (wersja dla Pythona 3)
+Group:		Development/Languages/Python
+Requires:	python3-Sphinx = %{version}-%{release}
+Conflicts:	sphinx-pdg < 1.3.2
+
+%description -n sphinx-pdg-3
+Sphinx is a tool that makes it easy to create intelligent and
+beautiful documentation for Python projects (or other documents
+consisting of multiple reStructuredText sources), written by Georg
+Brandl. It was originally created to translate the new Python
+documentation, but has now been cleaned up in the hope that it will be
+useful to many other projects.
+
+%description -n sphinx-pdg-3 -l pl.UTF-8
+Sphinx to narzędzie ułatwiające tworzenie inteligentnej i ładnej
+dokumentacji dla projektów w Pythonie (lub innych dokumentów
+składających się z wielu źródeł w formacie reStructuredText), napisane
+przez Georga Brandla. Pierwotnie powstało do tłumaczenia nowej
+dokumentacji Pythona, ale potem zostało wyczyszczone w nadziei, że
+będzie przydatne dla wielu innych projektów.
+
+%package doc
+Summary:	Documentation for Sphinx Python documentation generator
+Summary(pl.UTF-8):	Dokumentacja do generatora dokumentacji pythonowej Sphinx
+Group:		Documentation
+
+%description doc
+Documentation for Sphinx Python documentation generator.
+
+%description doc -l pl.UTF-8
+Dokumentacja do generatora dokumentacji pythonowej Sphinx.
+
+%prep
+%setup -q -n Sphinx-%{version}
+%patch0 -p1
+%patch1 -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 \
+PYTHONPATH=$(pwd) \
+%{__python} -m pytest tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+%{__rm} -r sphinx/__pycache__
+
+%if %{with tests}
+LC_ALL=C.UTF-8 \
+PYTHONPATH=$(pwd) \
+%{__python3} -m pytest tests
+%endif
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+%{__make} -C doc -j1 html man
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_mandir}/man1
+
+%if %{with python2}
+%py_install
+
+%{__rm} sphinx/__init__.pyc
+%py_postclean
+
+for f in $RPM_BUILD_ROOT%{_bindir}/*; do
+	%{__mv} "${f}" "${f}-2"
+done
+%if %{with doc}
+for f in doc/_build/man/*.1 ; do
+	cp -p "$f" $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $f .1)-2.1
+done
+%endif
+%endif
+
+%if %{with python3}
+%py3_install
+%{__rm} -r sphinx/__pycache__
+
+for f in $RPM_BUILD_ROOT%{_bindir}/*; do
+	[ "${f%%-2}" == "$f" ] || continue
+	%{__mv} "${f}" "${f}-3"
+done
+%if %{with doc}
+for f in doc/_build/man/*.1 ; do
+	cp -p "$f" $RPM_BUILD_ROOT%{_mandir}/man1/$(basename $f .1)-3.1
+done
+%endif
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS CHANGES EXAMPLES LICENSE README.rst
+%{py_sitescriptdir}/sphinx
+%{py_sitescriptdir}/Sphinx-%{version}-py*.egg-info
+
+%files -n sphinx-pdg-2
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/sphinx-apidoc-2
+%attr(755,root,root) %{_bindir}/sphinx-autogen-2
+%attr(755,root,root) %{_bindir}/sphinx-build-2
+%attr(755,root,root) %{_bindir}/sphinx-quickstart-2
+%if %{with doc}
+%{_mandir}/man1/sphinx-all-2.1*
+%{_mandir}/man1/sphinx-apidoc-2.1*
+%{_mandir}/man1/sphinx-autogen-2.1*
+%{_mandir}/man1/sphinx-build-2.1*
+%{_mandir}/man1/sphinx-quickstart-2.1*
+%endif
+%endif
+
+%if %{with python3}
+%files -n python3-Sphinx
+%defattr(644,root,root,755)
+%doc AUTHORS CHANGES EXAMPLES LICENSE README.rst
+%{py3_sitescriptdir}/sphinx
+%{py3_sitescriptdir}/Sphinx-%{version}-py*.egg-info
+
+%files -n sphinx-pdg-3
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/sphinx-apidoc-3
+%attr(755,root,root) %{_bindir}/sphinx-autogen-3
+%attr(755,root,root) %{_bindir}/sphinx-build-3
+%attr(755,root,root) %{_bindir}/sphinx-quickstart-3
+%if %{with doc}
+%{_mandir}/man1/sphinx-all-3.1*
+%{_mandir}/man1/sphinx-apidoc-3.1*
+%{_mandir}/man1/sphinx-autogen-3.1*
+%{_mandir}/man1/sphinx-build-3.1*
+%{_mandir}/man1/sphinx-quickstart-3.1*
+%endif
+%endif
+
+%if %{with doc}
+%files doc
+%defattr(644,root,root,755)
+%doc doc/_build/html/{_images,_static,extdev,man,usage,web,*.html,*.js}
+%endif
diff --git a/python-Sphinx-float-ver.patch b/python-Sphinx-float-ver.patch
new file mode 100644
index 0000000..e8bc18b
--- /dev/null
+++ b/python-Sphinx-float-ver.patch
@@ -0,0 +1,11 @@
+--- 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__:
++        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/python-Sphinx-mock.patch b/python-Sphinx-mock.patch
new file mode 100644
index 0000000..01ccdb6
--- /dev/null
+++ b/python-Sphinx-mock.patch
@@ -0,0 +1,122 @@
+--- Sphinx-1.7.6/setup.py.orig	2018-07-21 09:11:20.607543626 +0200
++++ Sphinx-1.7.6/setup.py	2018-07-21 09:14:00.757541787 +0200
+@@ -42,7 +42,6 @@
+         'whoosh>=2.0',
+     ],
+     'test': [
+-        'mock',
+         'pytest',
+         'pytest-cov',
+         'html5lib',
+--- Sphinx-1.7.6/tests/test_build.py.orig	2018-07-21 09:38:14.234191868 +0200
++++ Sphinx-1.7.6/tests/test_build.py	2018-07-21 09:39:37.260857586 +0200
+@@ -13,7 +13,10 @@
+ import sys
+ from textwrap import dedent
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ import pytest
+ from docutils import nodes
+ 
+--- Sphinx-1.7.6/tests/test_config.py.orig	2018-07-21 09:38:14.237525201 +0200
++++ Sphinx-1.7.6/tests/test_config.py	2018-07-21 09:39:59.077523735 +0200
+@@ -9,7 +9,10 @@
+     :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
+     :license: BSD, see LICENSE for details.
+ """
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ import pytest
+ from six import PY3, iteritems
+ 
+--- Sphinx-1.7.6/tests/test_domain_std.py.orig	2018-07-21 09:38:14.237525201 +0200
++++ Sphinx-1.7.6/tests/test_domain_std.py	2018-07-21 09:40:23.530857064 +0200
+@@ -9,7 +9,10 @@
+     :license: BSD, see LICENSE for details.
+ """
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ from docutils import nodes
+ 
+ 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:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ Environment = namedtuple('Environment', 'indexentries')
+ 
+--- Sphinx-1.7.6/tests/test_ext_intersphinx.py.orig	2018-07-21 09:38:14.237525201 +0200
++++ Sphinx-1.7.6/tests/test_ext_intersphinx.py	2018-07-21 09:40:47.824190102 +0200
+@@ -13,7 +13,10 @@
+ import unittest
+ from io import BytesIO
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ import pytest
+ import requests
+ from docutils import nodes
+--- Sphinx-1.7.6/tests/test_ext_napoleon_docstring.py.orig	2018-07-21 09:38:14.240858534 +0200
++++ Sphinx-1.7.6/tests/test_ext_napoleon_docstring.py	2018-07-21 09:41:38.977522865 +0200
+@@ -15,7 +15,10 @@
+ from textwrap import dedent
+ from unittest import TestCase
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ from sphinx.ext.napoleon import Config
+ from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring
+--- Sphinx-1.7.6/tests/test_ext_napoleon.py.orig	2018-07-21 09:38:14.240858534 +0200
++++ Sphinx-1.7.6/tests/test_ext_napoleon.py	2018-07-21 09:41:24.010856357 +0200
+@@ -13,7 +13,10 @@
+ from collections import namedtuple
+ from unittest import TestCase
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ from sphinx.application import Sphinx
+ from sphinx.ext.napoleon import _process_docstring, _skip_member, Config, setup
+--- 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:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ 
+ class DummyTemplateLoader(BuiltinTemplateLoader):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-Sphinx.git/commitdiff/f5bd08f783e333f793ff9c2df8c1966e82ede914



More information about the pld-cvs-commit mailing list