[packages/python-recommonmark] - added cm patch (adjust for commonmark 0.8) - added apidocs and tests - rel .2

qboosh qboosh at pld-linux.org
Wed Oct 10 21:44:02 CEST 2018


commit 03a31635b6efc2a18fd0a1b511568affed36d500
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Oct 10 21:47:30 2018 +0200

    - added cm patch (adjust for commonmark 0.8)
    - added apidocs and tests
    - rel .2

 python-recommonmark-cm.patch | 33 +++++++++++++++
 python-recommonmark.spec     | 96 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 125 insertions(+), 4 deletions(-)
---
diff --git a/python-recommonmark.spec b/python-recommonmark.spec
index a8fb147..7ac6d40 100644
--- a/python-recommonmark.spec
+++ b/python-recommonmark.spec
@@ -1,32 +1,50 @@
-# TODO:
-# - package tools
 #
 # Conditional build:
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
+%bcond_without	doc	# Sphinx documentation
+%bcond_without	tests	# unit tests
 
 %define		commit	33b5c2a4ec50d18d3f659aa119d3bd11452327da
-%define		commit_date 20180907
+%define		snap	20180907
+%define		rel	2
 
 Summary:	docutils-compatibility bridge to CommonMark
+Summary(pl.UTF-8):	Pomost zgodności z docutils dla CommonMark
 Name:		python-recommonmark
 Version:	0.5.0
-Release:	0.%{commit_date}.1
+Release:	0.%{snap}.%{rel}
 License:	MIT
 Group:		Libraries/Python
 Source0:	https://github.com/rtfd/recommonmark/archive/%{commit}/recommonmark-%{commit}.tar.gz
 # Source0-md5:	64cc2f674a76bf740594055a3be32a2d
+Patch0:		%{name}-cm.patch
 URL:		https://recommonmark.readthedocs.io/en/latest/
 %if %{with python2}
 BuildRequires:	python-modules >= 1:2.7
 BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-Sphinx >= 1.3.1
+BuildRequires:	python-commonmark >= 0.8
+BuildRequires:	python-docutils >= 0.11
+BuildRequires:	python-pytest
+%endif
 %endif
 %if %{with python3}
 BuildRequires:	python3-modules >= 1:3.3
 BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-Sphinx >= 1.3.1
+BuildRequires:	python3-commonmark >= 0.8
+BuildRequires:	python3-docutils >= 0.11
+BuildRequires:	python3-pytest
+%endif
 %endif
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires:	sphinx-pdg
+%endif
 Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -35,8 +53,13 @@ BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 This allows you to write CommonMark inside of Docutils & Sphinx
 projects.
 
+%description -l pl.UTF-8
+Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów
+Docutils i Sphinksa.
+
 %package -n python3-recommonmark
 Summary:	docutils-compatibility bridge to CommonMark
+Summary(pl.UTF-8):	Pomost zgodności z docutils dla CommonMark
 Group:		Libraries/Python
 Requires:	python3-modules >= 1:3.3
 
@@ -44,16 +67,46 @@ Requires:	python3-modules >= 1:3.3
 This allows you to write CommonMark inside of Docutils & Sphinx
 projects.
 
+%description -n python3-recommonmark -l pl.UTF-8
+Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów
+Docutils i Sphinksa.
+
+%package apidocs
+Summary:	Documentation for Python recommonmark module
+Summary(pl.UTF-8):	Dokumentacja modułu Pythona recommonmark
+Group:		Documentation
+
+%description apidocs
+Documentation for Python recommonmark module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja modułu Pythona recommonmark.
+
 %prep
 %setup -q -n recommonmark-%{commit}
+%patch0 -p1
 
 %build
 %if %{with python2}
 %py_build
+
+%if %{with tests} && 0
+# skip: python2 uses different XML formatting, tests expect python3 formatting
+%{__python} -m pytest tests
+%endif
 %endif
 
 %if %{with python3}
 %py3_build
+
+%if %{with tests}
+%{__python3} -m pytest tests
+%endif
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+%{__make} -C docs html
 %endif
 
 %install
@@ -63,10 +116,19 @@ rm -rf $RPM_BUILD_ROOT
 %py_install
 
 %py_postclean
+
+for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do
+	%{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-2
+done
 %endif
 
 %if %{with python3}
 %py3_install
+
+for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do
+	%{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-3
+	ln -sf ${f}-3 $RPM_BUILD_ROOT%{_bindir}/${f}
+done
 %endif
 
 %clean
@@ -75,6 +137,13 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
+%doc CHANGELOG.md README.md license.md
+%attr(755,root,root) %{_bindir}/cm2html-2
+%attr(755,root,root) %{_bindir}/cm2latex-2
+%attr(755,root,root) %{_bindir}/cm2man-2
+%attr(755,root,root) %{_bindir}/cm2pseudoxml-2
+%attr(755,root,root) %{_bindir}/cm2xetex-2
+%attr(755,root,root) %{_bindir}/cm2xml-2
 %{py_sitescriptdir}/recommonmark
 %{py_sitescriptdir}/recommonmark-%{version}.dev0-py*.egg-info
 %endif
@@ -82,6 +151,25 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python3}
 %files -n python3-recommonmark
 %defattr(644,root,root,755)
+%doc CHANGELOG.md README.md license.md
+%attr(755,root,root) %{_bindir}/cm2html
+%attr(755,root,root) %{_bindir}/cm2latex
+%attr(755,root,root) %{_bindir}/cm2man
+%attr(755,root,root) %{_bindir}/cm2pseudoxml
+%attr(755,root,root) %{_bindir}/cm2xetex
+%attr(755,root,root) %{_bindir}/cm2xml
+%attr(755,root,root) %{_bindir}/cm2html-3
+%attr(755,root,root) %{_bindir}/cm2latex-3
+%attr(755,root,root) %{_bindir}/cm2man-3
+%attr(755,root,root) %{_bindir}/cm2pseudoxml-3
+%attr(755,root,root) %{_bindir}/cm2xetex-3
+%attr(755,root,root) %{_bindir}/cm2xml-3
 %{py3_sitescriptdir}/recommonmark
 %{py3_sitescriptdir}/recommonmark-%{version}.dev0-py*.egg-info
 %endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_static,*.html,*.js}
+%endif
diff --git a/python-recommonmark-cm.patch b/python-recommonmark-cm.patch
new file mode 100644
index 0000000..599c7b3
--- /dev/null
+++ b/python-recommonmark-cm.patch
@@ -0,0 +1,33 @@
+--- recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/setup.py.orig	2018-09-07 17:24:28.000000000 +0200
++++ recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/setup.py	2018-10-10 21:41:32.681654515 +0200
+@@ -23,7 +23,7 @@
+         'License :: OSI Approved :: MIT License',
+     ],
+     install_requires=[
+-        'commonmark>=0.7.3',
++        'commonmark>=0.8',
+         'docutils>=0.11',
+         'sphinx>=1.3.1',
+     ],
+--- recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/recommonmark/parser.py.orig	2018-09-07 17:24:28.000000000 +0200
++++ recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/recommonmark/parser.py	2018-10-10 21:38:29.251656609 +0200
+@@ -6,7 +6,7 @@
+ from docutils import parsers, nodes
+ from sphinx import addnodes
+ 
+-from CommonMark import Parser
++from commonmark import Parser
+ 
+ from warnings import warn
+ 
+--- recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/tests/test_basic.py.orig	2018-09-07 17:24:28.000000000 +0200
++++ recommonmark-33b5c2a4ec50d18d3f659aa119d3bd11452327da/tests/test_basic.py	2018-10-10 21:38:29.248323276 +0200
+@@ -8,7 +8,7 @@
+ from docutils.readers import Reader
+ from docutils.core import publish_parts
+ 
+-from CommonMark import Parser
++from commonmark import Parser
+ from recommonmark.parser import CommonMarkParser
+ 
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-recommonmark.git/commitdiff/03a31635b6efc2a18fd0a1b511568affed36d500



More information about the pld-cvs-commit mailing list