]>
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 JP |
7 | |
8 | %define commit 33b5c2a4ec50d18d3f659aa119d3bd11452327da | |
03a31635 | 9 | %define snap 20180907 |
69420e1e | 10 | %define rel 3 |
5f21dfb6 JP |
11 | |
12 | Summary: docutils-compatibility bridge to CommonMark | |
03a31635 | 13 | Summary(pl.UTF-8): Pomost zgodności z docutils dla CommonMark |
5f21dfb6 JP |
14 | Name: python-recommonmark |
15 | Version: 0.5.0 | |
03a31635 | 16 | Release: 0.%{snap}.%{rel} |
5f21dfb6 JP |
17 | License: MIT |
18 | Group: Libraries/Python | |
19 | Source0: https://github.com/rtfd/recommonmark/archive/%{commit}/recommonmark-%{commit}.tar.gz | |
20 | # Source0-md5: 64cc2f674a76bf740594055a3be32a2d | |
03a31635 | 21 | Patch0: %{name}-cm.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 | |
28 | BuildRequires: python-commonmark >= 0.8 | |
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 | |
38 | BuildRequires: python3-commonmark >= 0.8 | |
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 JB |
45 | %if %{with doc} |
46 | BuildRequires: sphinx-pdg | |
47 | %endif | |
5f21dfb6 JP |
48 | Requires: python-modules >= 1:2.7 |
49 | BuildArch: noarch | |
50 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
51 | ||
52 | %description | |
53 | This allows you to write CommonMark inside of Docutils & Sphinx | |
54 | projects. | |
55 | ||
03a31635 JB |
56 | %description -l pl.UTF-8 |
57 | Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów | |
58 | Docutils i Sphinksa. | |
59 | ||
5f21dfb6 JP |
60 | %package -n python3-recommonmark |
61 | Summary: docutils-compatibility bridge to CommonMark | |
03a31635 | 62 | Summary(pl.UTF-8): Pomost zgodności z docutils dla CommonMark |
5f21dfb6 JP |
63 | Group: Libraries/Python |
64 | Requires: python3-modules >= 1:3.3 | |
65 | ||
66 | %description -n python3-recommonmark | |
67 | This allows you to write CommonMark inside of Docutils & Sphinx | |
68 | projects. | |
69 | ||
03a31635 JB |
70 | %description -n python3-recommonmark -l pl.UTF-8 |
71 | Ten moduł pozwala na pisanie z użyciem CommonMark wewnątrz projektów | |
72 | Docutils i Sphinksa. | |
73 | ||
74 | %package apidocs | |
75 | Summary: Documentation for Python recommonmark module | |
76 | Summary(pl.UTF-8): Dokumentacja modułu Pythona recommonmark | |
77 | Group: Documentation | |
78 | ||
79 | %description apidocs | |
80 | Documentation for Python recommonmark module. | |
81 | ||
82 | %description apidocs -l pl.UTF-8 | |
83 | Dokumentacja modułu Pythona recommonmark. | |
84 | ||
5f21dfb6 JP |
85 | %prep |
86 | %setup -q -n recommonmark-%{commit} | |
03a31635 | 87 | %patch0 -p1 |
5f21dfb6 JP |
88 | |
89 | %build | |
90 | %if %{with python2} | |
91 | %py_build | |
03a31635 JB |
92 | |
93 | %if %{with tests} && 0 | |
94 | # skip: python2 uses different XML formatting, tests expect python3 formatting | |
95 | %{__python} -m pytest tests | |
96 | %endif | |
5f21dfb6 JP |
97 | %endif |
98 | ||
99 | %if %{with python3} | |
100 | %py3_build | |
03a31635 JB |
101 | |
102 | %if %{with tests} | |
103 | %{__python3} -m pytest tests | |
104 | %endif | |
105 | %endif | |
106 | ||
107 | %if %{with doc} | |
108 | PYTHONPATH=$(pwd) \ | |
109 | %{__make} -C docs html | |
5f21dfb6 JP |
110 | %endif |
111 | ||
112 | %install | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %if %{with python2} | |
116 | %py_install | |
117 | ||
118 | %py_postclean | |
03a31635 JB |
119 | |
120 | for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do | |
121 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-2 | |
122 | done | |
5f21dfb6 JP |
123 | %endif |
124 | ||
125 | %if %{with python3} | |
126 | %py3_install | |
03a31635 JB |
127 | |
128 | for f in cm2{html,latex,man,pseudoxml,xetex,xml} ; do | |
129 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/${f} $RPM_BUILD_ROOT%{_bindir}/${f}-3 | |
130 | ln -sf ${f}-3 $RPM_BUILD_ROOT%{_bindir}/${f} | |
131 | done | |
5f21dfb6 JP |
132 | %endif |
133 | ||
134 | %clean | |
135 | rm -rf $RPM_BUILD_ROOT | |
136 | ||
137 | %if %{with python2} | |
138 | %files | |
139 | %defattr(644,root,root,755) | |
03a31635 JB |
140 | %doc CHANGELOG.md README.md license.md |
141 | %attr(755,root,root) %{_bindir}/cm2html-2 | |
142 | %attr(755,root,root) %{_bindir}/cm2latex-2 | |
143 | %attr(755,root,root) %{_bindir}/cm2man-2 | |
144 | %attr(755,root,root) %{_bindir}/cm2pseudoxml-2 | |
145 | %attr(755,root,root) %{_bindir}/cm2xetex-2 | |
146 | %attr(755,root,root) %{_bindir}/cm2xml-2 | |
5f21dfb6 JP |
147 | %{py_sitescriptdir}/recommonmark |
148 | %{py_sitescriptdir}/recommonmark-%{version}.dev0-py*.egg-info | |
149 | %endif | |
150 | ||
151 | %if %{with python3} | |
152 | %files -n python3-recommonmark | |
153 | %defattr(644,root,root,755) | |
03a31635 JB |
154 | %doc CHANGELOG.md README.md license.md |
155 | %attr(755,root,root) %{_bindir}/cm2html | |
156 | %attr(755,root,root) %{_bindir}/cm2latex | |
157 | %attr(755,root,root) %{_bindir}/cm2man | |
158 | %attr(755,root,root) %{_bindir}/cm2pseudoxml | |
159 | %attr(755,root,root) %{_bindir}/cm2xetex | |
160 | %attr(755,root,root) %{_bindir}/cm2xml | |
161 | %attr(755,root,root) %{_bindir}/cm2html-3 | |
162 | %attr(755,root,root) %{_bindir}/cm2latex-3 | |
163 | %attr(755,root,root) %{_bindir}/cm2man-3 | |
164 | %attr(755,root,root) %{_bindir}/cm2pseudoxml-3 | |
165 | %attr(755,root,root) %{_bindir}/cm2xetex-3 | |
166 | %attr(755,root,root) %{_bindir}/cm2xml-3 | |
5f21dfb6 JP |
167 | %{py3_sitescriptdir}/recommonmark |
168 | %{py3_sitescriptdir}/recommonmark-%{version}.dev0-py*.egg-info | |
169 | %endif | |
03a31635 JB |
170 | |
171 | %if %{with doc} | |
172 | %files apidocs | |
173 | %defattr(644,root,root,755) | |
174 | %doc docs/_build/html/{_static,*.html,*.js} | |
175 | %endif |