]>
Commit | Line | Data |
---|---|---|
5f21dfb6 JP |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without python2 # CPython 2.x module | |
4 | %bcond_without python3 # CPython 3.x module | |
03a31635 JB |
5 | %bcond_without doc # Sphinx documentation |
6 | %bcond_without tests # unit tests | |
5f21dfb6 | 7 | |
5f21dfb6 | 8 | Summary: docutils-compatibility bridge to CommonMark |
03a31635 | 9 | Summary(pl.UTF-8): Pomost zgodności z docutils dla CommonMark |
5f21dfb6 | 10 | Name: python-recommonmark |
ce0249e4 | 11 | Version: 0.7.1 |
97f540c5 | 12 | Release: 4 |
5f21dfb6 JP |
13 | License: MIT |
14 | Group: Libraries/Python | |
69a34bb0 JB |
15 | #Source0Download: https://pypi.org/simple/recommonmark/ |
16 | Source0: https://files.pythonhosted.org/packages/source/r/recommonmark/recommonmark-%{version}.tar.gz | |
ce0249e4 | 17 | # Source0-md5: 3c550a76eb62006bf007843a9f1805bb |
69a34bb0 JB |
18 | # from https://github.com/readthedocs/recommonmark/pull/124 |
19 | # https://github.com/readthedocs/recommonmark/commit/917e0359fa93acd9b22d7122e2c03d994d9fda44.patch | |
20 | Patch0: %{name}-math.patch | |
b5d6a45d | 21 | Patch1: %{name}-docutils.patch |
5f21dfb6 JP |
22 | URL: https://recommonmark.readthedocs.io/en/latest/ |
23 | %if %{with python2} | |
24 | BuildRequires: python-modules >= 1:2.7 | |
25 | BuildRequires: python-setuptools | |
03a31635 JB |
26 | %if %{with tests} |
27 | BuildRequires: python-Sphinx >= 1.3.1 | |
69a34bb0 | 28 | BuildRequires: python-commonmark >= 0.8.1 |
03a31635 JB |
29 | BuildRequires: python-docutils >= 0.11 |
30 | BuildRequires: python-pytest | |
31 | %endif | |
5f21dfb6 JP |
32 | %endif |
33 | %if %{with python3} | |
34 | BuildRequires: python3-modules >= 1:3.3 | |
35 | BuildRequires: python3-setuptools | |
03a31635 JB |
36 | %if %{with tests} |
37 | BuildRequires: python3-Sphinx >= 1.3.1 | |
69a34bb0 | 38 | BuildRequires: python3-commonmark >= 0.8.1 |
03a31635 JB |
39 | BuildRequires: python3-docutils >= 0.11 |
40 | BuildRequires: python3-pytest | |
41 | %endif | |
5f21dfb6 JP |
42 | %endif |
43 | BuildRequires: rpm-pythonprov | |
44 | BuildRequires: rpmbuild(macros) >= 1.714 | |
03a31635 | 45 | %if %{with doc} |
342440e0 | 46 | BuildRequires: python3-commonmark >= 0.8.1 |
03a31635 JB |
47 | BuildRequires: sphinx-pdg |
48 | %endif | |
5f21dfb6 JP |
49 | Requires: python-modules >= 1:2.7 |
50 | BuildArch: noarch | |
51 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
52 | ||
53 | %description | |
54 | This allows you to write CommonMark inside of Docutils & Sphinx | |
55 | projects. | |
56 | ||
03a31635 JB |
57 | %description -l pl.UTF-8 |
58 | Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów | |
59 | Docutils i Sphinksa. | |
60 | ||
5f21dfb6 JP |
61 | %package -n python3-recommonmark |
62 | Summary: docutils-compatibility bridge to CommonMark | |
03a31635 | 63 | Summary(pl.UTF-8): Pomost zgodności z docutils dla CommonMark |
5f21dfb6 JP |
64 | Group: Libraries/Python |
65 | Requires: python3-modules >= 1:3.3 | |
66 | ||
67 | %description -n python3-recommonmark | |
68 | This allows you to write CommonMark inside of Docutils & Sphinx | |
69 | projects. | |
70 | ||
03a31635 JB |
71 | %description -n python3-recommonmark -l pl.UTF-8 |
72 | Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów | |
73 | Docutils i Sphinksa. | |
74 | ||
75 | %package apidocs | |
76 | Summary: Documentation for Python recommonmark module | |
77 | Summary(pl.UTF-8): Dokumentacja modułu Pythona recommonmark | |
78 | Group: Documentation | |
79 | ||
80 | %description apidocs | |
81 | Documentation for Python recommonmark module. | |
82 | ||
83 | %description apidocs -l pl.UTF-8 | |
84 | Dokumentacja modułu Pythona recommonmark. | |
85 | ||
5f21dfb6 | 86 | %prep |
69a34bb0 | 87 | %setup -q -n recommonmark-%{version} |
03a31635 | 88 | %patch0 -p1 |
b5d6a45d | 89 | %patch1 -p1 |
5f21dfb6 JP |
90 | |
91 | %build | |
92 | %if %{with python2} | |
93 | %py_build | |
03a31635 | 94 | |
ce0249e4 | 95 | %if %{with tests} |
03a31635 | 96 | # skip: python2 uses different XML formatting, tests expect python3 formatting |
ce0249e4 | 97 | %{__python} -m pytest tests -k 'not CustomExtensionTests' |
03a31635 | 98 | %endif |
5f21dfb6 JP |
99 | %endif |
100 | ||
101 | %if %{with python3} | |
102 | %py3_build | |
03a31635 JB |
103 | |
104 | %if %{with tests} | |
ce0249e4 JB |
105 | # sphinx tests are too dependent on Sphinx version |
106 | %{__python3} -m pytest tests -k 'not test_sphinx' | |
03a31635 JB |
107 | %endif |
108 | %endif | |
109 | ||
110 | %if %{with doc} | |
111 | PYTHONPATH=$(pwd) \ | |
112 | %{__make} -C docs html | |
5f21dfb6 JP |
113 | %endif |
114 | ||
115 | %install | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
118 | %if %{with python2} | |
119 | %py_install | |
120 | ||
121 | %py_postclean | |
03a31635 JB |
122 | |
123 | for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do | |
124 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-2 | |
125 | done | |
5f21dfb6 JP |
126 | %endif |
127 | ||
128 | %if %{with python3} | |
129 | %py3_install | |
03a31635 JB |
130 | |
131 | for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do | |
132 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-3 | |
133 | ln -sf ${f}-3 $RPM_BUILD_ROOT%{_bindir}/${f} | |
134 | done | |
5f21dfb6 JP |
135 | %endif |
136 | ||
137 | %clean | |
138 | rm -rf $RPM_BUILD_ROOT | |
139 | ||
140 | %if %{with python2} | |
141 | %files | |
142 | %defattr(644,root,root,755) | |
03a31635 JB |
143 | %doc CHANGELOG.md README.md license.md |
144 | %attr(755,root,root) %{_bindir}/cm2html-2 | |
145 | %attr(755,root,root) %{_bindir}/cm2latex-2 | |
146 | %attr(755,root,root) %{_bindir}/cm2man-2 | |
147 | %attr(755,root,root) %{_bindir}/cm2pseudoxml-2 | |
148 | %attr(755,root,root) %{_bindir}/cm2xetex-2 | |
149 | %attr(755,root,root) %{_bindir}/cm2xml-2 | |
5f21dfb6 | 150 | %{py_sitescriptdir}/recommonmark |
69a34bb0 | 151 | %{py_sitescriptdir}/recommonmark-%{version}-py*.egg-info |
5f21dfb6 JP |
152 | %endif |
153 | ||
154 | %if %{with python3} | |
155 | %files -n python3-recommonmark | |
156 | %defattr(644,root,root,755) | |
03a31635 JB |
157 | %doc CHANGELOG.md README.md license.md |
158 | %attr(755,root,root) %{_bindir}/cm2html | |
159 | %attr(755,root,root) %{_bindir}/cm2latex | |
160 | %attr(755,root,root) %{_bindir}/cm2man | |
161 | %attr(755,root,root) %{_bindir}/cm2pseudoxml | |
162 | %attr(755,root,root) %{_bindir}/cm2xetex | |
163 | %attr(755,root,root) %{_bindir}/cm2xml | |
164 | %attr(755,root,root) %{_bindir}/cm2html-3 | |
165 | %attr(755,root,root) %{_bindir}/cm2latex-3 | |
166 | %attr(755,root,root) %{_bindir}/cm2man-3 | |
167 | %attr(755,root,root) %{_bindir}/cm2pseudoxml-3 | |
168 | %attr(755,root,root) %{_bindir}/cm2xetex-3 | |
169 | %attr(755,root,root) %{_bindir}/cm2xml-3 | |
5f21dfb6 | 170 | %{py3_sitescriptdir}/recommonmark |
69a34bb0 | 171 | %{py3_sitescriptdir}/recommonmark-%{version}-py*.egg-info |
5f21dfb6 | 172 | %endif |
03a31635 JB |
173 | |
174 | %if %{with doc} | |
175 | %files apidocs | |
176 | %defattr(644,root,root,755) | |
177 | %doc docs/_build/html/{_static,*.html,*.js} | |
178 | %endif |