]>
Commit | Line | Data |
---|---|---|
85aef10d JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # unit tests | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | Summary: Python 2 API and tools to manipulate OpenDocument files | |
8 | Summary(pl.UTF-8): API i narzędzia Pythona 2 do operacji na dokumentach OpenDocument | |
9 | Name: python-odfpy | |
10 | Version: 1.4.1 | |
5557b5b8 | 11 | Release: 4 |
85aef10d JB |
12 | License: LGPL v2.1+ (module), Apache v2.0 and GPL v2+ (tools) |
13 | Group: Libraries/Python | |
14 | #Source0Download: https://pypi.org/simple/odfpy/ | |
15 | Source0: https://files.pythonhosted.org/packages/source/o/odfpy/odfpy-%{version}.tar.gz | |
16 | # Source0-md5: d1a186ae75b2ae038a8aab1396444342 | |
17 | URL: https://pypi.org/project/odfpy/ | |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.714 | |
20 | %if %{with python2} | |
21 | BuildRequires: python-modules >= 1:2.7 | |
22 | BuildRequires: python-setuptools | |
23 | %if %{with tests} | |
24 | BuildRequires: python-defusedxml | |
25 | BuildRequires: python-pytest | |
26 | %endif | |
27 | %endif | |
28 | %if %{with python3} | |
29 | BuildRequires: python3-modules >= 1:3.4 | |
30 | BuildRequires: python3-setuptools | |
31 | %if %{with tests} | |
32 | BuildRequires: python3-defusedxml | |
33 | BuildRequires: python3-pytest | |
34 | %endif | |
35 | %endif | |
36 | Requires: python-modules >= 1:2.7 | |
37 | BuildArch: noarch | |
38 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
39 | ||
40 | %description | |
41 | Odfpy is a library to read and write OpenDocument v. 1.2 files. The | |
42 | main focus has been to prevent the programmer from creating invalid | |
43 | documents. It has checks that raise an exception if the programmer | |
44 | adds an invalid element, adds an attribute unknown to the grammar, | |
45 | forgets to add a required attribute or adds text to an element that | |
46 | doesn't allow it. | |
47 | ||
48 | %description -l pl.UTF-8 | |
49 | Odfpy to biblioteka do odczytu i zapisu plików OpenDocument w wersji | |
50 | 1.2. Główny nacisk został położony na tym, aby nie pozwolić | |
51 | programiście na utworzenie błędnych dokumentów. Biblioteka rzuca | |
52 | wyjątek, jeśli programista dodaje błędny element, dodaje element | |
53 | nieznany gramatyce, zapomina dodać wymagany atrybut lub dodaje tekst | |
54 | do elementu, który na to nie pozwala. | |
55 | ||
56 | %package -n python3-odfpy | |
57 | Summary: Python 3 API and tools to manipulate OpenDocument files | |
58 | Summary(pl.UTF-8): API i narzędzia Pythona 3 do operacji na dokumentach OpenDocument | |
59 | Group: Libraries/Python | |
60 | Requires: python3-modules >= 1:3.4 | |
61 | ||
62 | %description -n python3-odfpy | |
63 | Odfpy is a library to read and write OpenDocument v. 1.2 files. The | |
64 | main focus has been to prevent the programmer from creating invalid | |
65 | documents. It has checks that raise an exception if the programmer | |
66 | adds an invalid element, adds an attribute unknown to the grammar, | |
67 | forgets to add a required attribute or adds text to an element that | |
68 | doesn't allow it. | |
69 | ||
70 | %description -n python3-odfpy -l pl.UTF-8 | |
71 | Odfpy to biblioteka do odczytu i zapisu plików OpenDocument w wersji | |
72 | 1.2. Główny nacisk został położony na tym, aby nie pozwolić | |
73 | programiście na utworzenie błędnych dokumentów. Biblioteka rzuca | |
74 | wyjątek, jeśli programista dodaje błędny element, dodaje element | |
75 | nieznany gramatyce, zapomina dodać wymagany atrybut lub dodaje tekst | |
76 | do elementu, który na to nie pozwala. | |
77 | ||
78 | %package -n odfpy-tools | |
79 | Summary: Tools to manipulate OpenDocument files | |
80 | Summary(pl.UTF-8): Narzędzia do operacji na dokumentach OpenDocument | |
81 | Group: Applications/Publishing | |
82 | %if %{with python3} | |
83 | Requires: python3-odfpy = %{version}-%{release} | |
84 | %else | |
85 | Requires: python-odfpy = %{version}-%{release} | |
86 | %endif | |
87 | ||
88 | %description -n odfpy-tools | |
89 | Tools to manipulate OpenDocument files. | |
90 | ||
91 | %description -n odfpy-tools -l pl.UTF-8 | |
92 | Narzędzia do operacji na dokumentach OpenDocument. | |
93 | ||
94 | %prep | |
95 | %setup -q -n odfpy-%{version} | |
96 | ||
97 | %build | |
98 | %if %{with python2} | |
99 | %py_build | |
100 | ||
101 | %if %{with tests} | |
102 | # test_xmlgenerator_wo_ns apparently fails with python 2.7 | |
16af56cf | 103 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
85aef10d JB |
104 | %{__python} -m pytest tests -k 'not test_xmlgenerator_wo_ns' |
105 | %endif | |
106 | %endif | |
107 | ||
108 | %if %{with python3} | |
109 | %py3_build | |
110 | ||
111 | %if %{with tests} | |
16af56cf | 112 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
85aef10d JB |
113 | %{__python3} -m pytest tests |
114 | %endif | |
115 | %endif | |
116 | ||
117 | %install | |
118 | rm -rf $RPM_BUILD_ROOT | |
119 | ||
120 | %if %{with python2} | |
121 | %py_install | |
122 | ||
123 | %py_postclean | |
124 | ||
125 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
126 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
127 | ||
128 | %if %{with python3} | |
129 | # ensure packaged tools are python3 based | |
130 | %{__rm} -r $RPM_BUILD_ROOT{%{_bindir},%{_mandir}} | |
131 | %endif | |
132 | %endif | |
133 | ||
134 | %if %{with python3} | |
135 | %py3_install | |
136 | ||
137 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-odfpy-%{version} | |
138 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-odfpy-%{version} | |
139 | %endif | |
140 | ||
141 | %clean | |
142 | rm -rf $RPM_BUILD_ROOT | |
143 | ||
144 | %if %{with python2} | |
145 | %files | |
146 | %defattr(644,root,root,755) | |
147 | %doc ChangeLog README.md | |
148 | %{py_sitescriptdir}/odf | |
149 | %{py_sitescriptdir}/odfpy-%{version}-py*.egg-info | |
150 | %{_examplesdir}/python-odfpy-%{version} | |
151 | %endif | |
152 | ||
153 | %if %{with python3} | |
154 | %files -n python3-odfpy | |
155 | %defattr(644,root,root,755) | |
156 | %doc ChangeLog README.md | |
157 | %{py3_sitescriptdir}/odf | |
158 | %{py3_sitescriptdir}/odfpy-%{version}-py*.egg-info | |
159 | %{_examplesdir}/python3-odfpy-%{version} | |
160 | %endif | |
161 | ||
162 | %files -n odfpy-tools | |
163 | %defattr(644,root,root,755) | |
164 | %attr(755,root,root) %{_bindir}/csv2ods | |
165 | %attr(755,root,root) %{_bindir}/mailodf | |
166 | %attr(755,root,root) %{_bindir}/odf2mht | |
167 | %attr(755,root,root) %{_bindir}/odf2xhtml | |
168 | %attr(755,root,root) %{_bindir}/odf2xml | |
169 | %attr(755,root,root) %{_bindir}/odfimgimport | |
170 | %attr(755,root,root) %{_bindir}/odflint | |
171 | %attr(755,root,root) %{_bindir}/odfmeta | |
172 | %attr(755,root,root) %{_bindir}/odfoutline | |
173 | %attr(755,root,root) %{_bindir}/odfuserfield | |
174 | %attr(755,root,root) %{_bindir}/xml2odf | |
175 | %{_mandir}/man1/csv2ods.1* | |
176 | %{_mandir}/man1/mailodf.1* | |
177 | %{_mandir}/man1/odf2mht.1* | |
178 | %{_mandir}/man1/odf2xhtml.1* | |
179 | %{_mandir}/man1/odf2xml.1* | |
180 | %{_mandir}/man1/odfimgimport.1* | |
181 | %{_mandir}/man1/odflint.1* | |
182 | %{_mandir}/man1/odfmeta.1* | |
183 | %{_mandir}/man1/odfoutline.1* | |
184 | %{_mandir}/man1/odfuserfield.1* | |
185 | %{_mandir}/man1/xml2odf.1* |