]> git.pld-linux.org Git - packages/python-recommonmark.git/blobdiff - python-recommonmark.spec
- added cm patch (adjust for commonmark 0.8)
[packages/python-recommonmark.git] / python-recommonmark.spec
index a8fb147bf3c7872b0a15363add51ec408bf1db9e..7ac6d4051193653d3811d235160fe715520e3b78 100644 (file)
@@ -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
This page took 0.049049 seconds and 4 git commands to generate.